s/qmail 4.2.29a
Next generation secure email transport
Loading...
Searching...
No Matches
except.c
Go to the documentation of this file.
1#include <unistd.h>
2#include "wait.h"
3#include "logmsg.h"
4#include "exit.h"
5
6#define WHO "except"
7
8int main(int argc, char **argv)
9{
10 int pid;
11 int wstat;
12
13 if (!argv[1])
14 logmsg(WHO,100,USAGE,"except program [ arg ... ]");
15
16 pid = fork();
17 if (pid == -1)
18 logmsg(WHO,111,FATAL,"unable to fork: ");
19 if (pid == 0) {
20 execvp(argv[1],argv + 1);
21 if (errno) _exit(111);
22 _exit(100);
23 }
24
25 if (wait_pid(&wstat,pid) == -1)
26 logmsg(WHO,111,FATAL,"wait failed");
27 if (wait_crashed(wstat))
28 logmsg(WHO,111,FATAL,"child crashed");
29 switch (wait_exitcode(wstat)) {
30 case 0: _exit(100);
31 case 111: logmsg(WHO,111,FATAL,"temporary child error");
32 default: _exit(0);
33 }
34}
int main()
Definition: chkshsgr.c:6
#define WHO
Definition: except.c:6
void _exit()