Replace execv with execvp as it has the more natural behaviour
This commit is contained in:
		
							
								
								
									
										16
									
								
								adhocify.c
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								adhocify.c
									
									
									
									
									
								
							@@ -278,8 +278,8 @@ bool run_prog(const char *eventfile,  uint32_t eventmask)
 | 
				
			|||||||
				script_arguments[i] = eventfile;
 | 
									script_arguments[i] = eventfile;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		execv(prog, script_arguments);
 | 
							execvp(prog, script_arguments);
 | 
				
			||||||
		perror("execv");
 | 
							logerror("Exec of %s failed: %s\n", prog, strerror(errno));
 | 
				
			||||||
		return false;
 | 
							return false;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if(pid == -1)
 | 
						if(pid == -1)
 | 
				
			||||||
@@ -577,12 +577,6 @@ void process_options()
 | 
				
			|||||||
		mask |= IN_CLOSE_WRITE;
 | 
							mask |= IN_CLOSE_WRITE;
 | 
				
			||||||
	}	
 | 
						}	
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	if(! file_exists(prog))
 | 
					 | 
				
			||||||
	{
 | 
					 | 
				
			||||||
		fprintf(stderr, "File %s does not exist\n", prog);
 | 
					 | 
				
			||||||
		exit(EXIT_FAILURE);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	if(path_logfile)
 | 
						if(path_logfile)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		path_logfile = xrealpath(path_logfile, NULL);
 | 
							path_logfile = xrealpath(path_logfile, NULL);
 | 
				
			||||||
@@ -590,9 +584,13 @@ void process_options()
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	if(forkbombcheck)
 | 
						if(forkbombcheck)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		char *path_prog = xrealpath(prog, NULL);
 | 
							char *path_prog = realpath(prog, NULL);
 | 
				
			||||||
 | 
							if(path_prog != NULL)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
			check_forkbomb(path_logfile, path_prog);
 | 
								check_forkbomb(path_logfile, path_prog);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
							free(path_prog);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(daemonize)
 | 
						if(daemonize)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user