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