diff options
| author | Tristan Riehs <tristan.riehs@bordeaux-inp.fr> | 2023-11-11 19:59:09 +0100 | 
|---|---|---|
| committer | Tristan Riehs <tristan.riehs@bordeaux-inp.fr> | 2023-11-11 19:59:09 +0100 | 
| commit | a8abc24ce9dfa0bf85eeb405f98e29a3c76e647b (patch) | |
| tree | 041fb7fa82bd2dae058998d87ed65a366162f9f3 | |
| parent | d003f738d9c583afa976efc252740c68a37479bb (diff) | |
wait instead of waitpid
| -rw-r--r-- | rpt.c | 12 | 
1 files changed, 6 insertions, 6 deletions
| @@ -96,13 +96,13 @@ exec_child(char **argv)  }  void -wait_child(pid_t pid, void (*handle_error_f)(int status)) +wait_child(void (*handle_error_f)(int status))  { -	int exit_status = 0; +	int wstatus; -	waitpid(pid, &exit_status, 0); +	wait(&wstatus); -	handle_error_f(exit_status); +	handle_error_f(WEXITSTATUS(wstatus));  }  void @@ -119,10 +119,10 @@ invoke_cmd(char **argv, void (*handle_error_f)(int status))  	if (pid == 0)  		exec_child(argv);  	else -		wait_child(pid, handle_error_f); +		wait_child(handle_error_f);  } -/* Invoke the executable *ARGV COUNT times, passing it the rest of ARG as +/* Invoke the executable *ARGV COUNT times, passing it the rest of ARGV as     arguments. Call HANDLE_ERROR_F between each process. */  void  repeat_cmd(char **argv, long count, void (*handle_error_f)(int status)) | 
