diff options
author | Bill Nottingham <notting@redhat.com> | 1999-04-09 02:29:09 +0000 |
---|---|---|
committer | Bill Nottingham <notting@redhat.com> | 1999-04-09 02:29:09 +0000 |
commit | e8dcf9d4cf078a8cc8dd647000db737fc8a020b7 (patch) | |
tree | 103b063623afce74adafd5dbc1d4b77b65a4e506 /src/minilogd.c | |
parent | 44e8ff24a4a674818c27e9435274333a99c4e02e (diff) | |
download | initscripts-e8dcf9d4cf078a8cc8dd647000db737fc8a020b7.tar initscripts-e8dcf9d4cf078a8cc8dd647000db737fc8a020b7.tar.gz initscripts-e8dcf9d4cf078a8cc8dd647000db737fc8a020b7.tar.bz2 initscripts-e8dcf9d4cf078a8cc8dd647000db737fc8a020b7.tar.xz initscripts-e8dcf9d4cf078a8cc8dd647000db737fc8a020b7.zip |
fixeds for the case where /dev/log exists at boot
Diffstat (limited to 'src/minilogd.c')
-rw-r--r-- | src/minilogd.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/minilogd.c b/src/minilogd.c index 345ec3c4..b0432408 100644 --- a/src/minilogd.c +++ b/src/minilogd.c @@ -23,6 +23,8 @@ static int we_own_log=0; static char **buffer=NULL; static int buflines=0; +int debug; + void freeBuffer() { struct sockaddr_un addr; int sock; @@ -50,7 +52,6 @@ void cleanup(int exitcode) { unlink(_PATH_LOG); } /* Don't try to free buffer if we were called from a signal handler */ - perror("foo"); if (exitcode<=0) { if (buffer) freeBuffer(); exit(exitcode); @@ -121,11 +122,13 @@ void runDaemon(int sock) { cleanup(0); } -int main() { +int main(int argc, char **argv) { struct sockaddr_un addr; int sock; int pid; + /* option processing made simple... */ + if (argc>1) debug=1; /* just in case */ sock = open("/dev/null",O_RDWR); dup2(sock,0); @@ -143,16 +146,16 @@ int main() { listen(sock,5); if ((pid=fork())==-1) { perror("fork"); - exit(-1); + exit(3); } if (pid) { exit(0); } else { runDaemon(sock); /* shouldn't get back here... */ - exit(-1); + exit(4); } } else { - exit(-1); + exit(5); } } |