Compare commits

..

No commits in common. "67a148c7aa418488084c7b0753d1769fcc2f48ab" and "730d6bc27d0180f33b9eed81bc4791d4128f4e46" have entirely different histories.

3 changed files with 5 additions and 11 deletions

1
.gitignore vendored
View File

@ -2,4 +2,3 @@ build/*
.clang-tidy
.cache
test/protected/*
compile_commands.json

View File

@ -264,7 +264,7 @@ static int xmp_unlink(const char *path) {
// fprintf(stderr, "%s, %d\n", path, ask_access(path, pi));
if (!interactive_access(real_filename(path), pi)) {
if (interactive_access(real_filename(path), pi)) {
free(pi.name);
return -EACCES;
}
@ -392,7 +392,7 @@ static int xmp_create(const char *path, mode_t mode,
// fprintf(stderr, "%s, %d\n", path, ask_access(path, pi));
if (!interactive_access(real_filename(path), pi)) {
if (interactive_access(real_filename(path), pi)) {
free(pi.name);
return -EACCES;
}
@ -417,7 +417,7 @@ static int xmp_open(const char *path, struct fuse_file_info *fi) {
pi.name = get_process_name_by_pid(pi.PID);
// fprintf(stderr, "%s, %d\n", path, ask_access(path, pi));
if (!interactive_access(real_filename(path), pi)) {
if (interactive_access(real_filename(path), pi)) {
free(pi.name);
return -EACCES;
}

View File

@ -71,19 +71,14 @@ int ask_access(const char *filename, struct process_info pi) {
// to manually check the output.
char buffer[1024];
while (fgets(buffer, sizeof(buffer), fp)) {
if (strcmp(buffer, "Allow this time\n") == 0) {
if (strcmp(buffer, "Allow this time.\n") == 0) {
pclose(fp);
return 2;
}
}
int zenity_exit_code = WEXITSTATUS(pclose(fp));
// zenity returns 1 on "No" >:(
if (zenity_exit_code == 0) {
return 1;
}
return 0;
return zenity_exit_code;
}
/**