check: only call setpgid on valid child PIDs

Coverity 206186
This commit is contained in:
Vincent Penquerc'h 2014-04-07 15:38:09 +01:00
parent 9c821554fc
commit b9313afc75

View file

@ -571,6 +571,7 @@ check_fork (void)
#ifdef _POSIX_VERSION #ifdef _POSIX_VERSION
pid_t pid = fork (); pid_t pid = fork ();
/* Set the process to a process group to be able to kill it easily. */ /* Set the process to a process group to be able to kill it easily. */
if (pid > 0)
setpgid (pid, group_pid); setpgid (pid, group_pid);
return pid; return pid;
#else /* _POSIX_VERSION */ #else /* _POSIX_VERSION */