Compare commits
	
		
			2 Commits
		
	
	
		
			730d6bc27d
			...
			67a148c7aa
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					67a148c7aa | ||
| 
						 | 
					c59123330f | 
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@@ -2,3 +2,4 @@ build/*
 | 
			
		||||
.clang-tidy
 | 
			
		||||
.cache
 | 
			
		||||
test/protected/*
 | 
			
		||||
compile_commands.json
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
  }
 | 
			
		||||
 
 | 
			
		||||
@@ -71,14 +71,19 @@ 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));
 | 
			
		||||
  return zenity_exit_code;
 | 
			
		||||
  // zenity returns 1 on "No" >:(
 | 
			
		||||
  if (zenity_exit_code == 0) {
 | 
			
		||||
    return 1;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user