version 1.77, 2016/10/18 20:07:35 |
version 1.78, 2017/08/21 21:41:13 |
|
|
execv(_PATH_BSHELL, argp); |
execv(_PATH_BSHELL, argp); |
_exit(127); |
_exit(127); |
} |
} |
while (waitpid(pid, &st, 0) == -1) |
while (waitpid(pid, &st, 0) == -1) { |
if (errno != EINTR) |
if (errno != EINTR) |
goto fail; |
goto fail; |
|
} |
if (!WIFEXITED(st)) |
if (!WIFEXITED(st)) |
errno = EINTR; |
errno = EINTR; |
else |
else |
|
|
sendmail(const char *pathname) |
sendmail(const char *pathname) |
{ |
{ |
int filedes[2]; |
int filedes[2]; |
|
pid_t pid; |
|
|
if (pipe(filedes) == -1) { |
if (pipe(filedes) == -1) { |
warn("pipe: unsent report in %s", pathname); |
warn("pipe: unsent report in %s", pathname); |
return (-1); |
return (-1); |
} |
} |
switch (fork()) { |
switch ((pid = fork())) { |
case -1: |
case -1: |
warn("fork error: unsent report in %s", |
warn("fork error: unsent report in %s", |
pathname); |
pathname); |
|
|
return (-1); |
return (-1); |
} |
} |
close(filedes[1]); |
close(filedes[1]); |
wait(NULL); |
while (waitpid(pid, NULL, 0) == -1) { |
|
if (errno != EINTR) |
|
break; |
|
} |
break; |
break; |
} |
} |
return (0); |
return (0); |