moved signal handlers before port binding

This commit is contained in:
Anselm R Garbe 2009-08-16 13:33:02 +01:00
parent 1301be6ce8
commit c19e5e6724

16
quark.c
View file

@ -383,6 +383,14 @@ main(int argc, char *argv[]) {
if(!(gpwd = getpwnam(group))) if(!(gpwd = getpwnam(group)))
die("error: invalid group %s\n", group); die("error: invalid group %s\n", group);
signal(SIGCHLD, sighandler);
signal(SIGHUP, sighandler);
signal(SIGINT, sighandler);
signal(SIGQUIT, sighandler);
signal(SIGABRT, sighandler);
signal(SIGTERM, sighandler);
signal(SIGKILL, sighandler);
/* init */ /* init */
setbuf(stdout, NULL); /* unbuffered stdout */ setbuf(stdout, NULL); /* unbuffered stdout */
memset(&hints, 0, sizeof hints); memset(&hints, 0, sizeof hints);
@ -416,14 +424,6 @@ main(int argc, char *argv[]) {
die("error: location too long\n"); die("error: location too long\n");
} }
signal(SIGCHLD, sighandler);
signal(SIGHUP, sighandler);
signal(SIGINT, sighandler);
signal(SIGQUIT, sighandler);
signal(SIGABRT, sighandler);
signal(SIGTERM, sighandler);
signal(SIGKILL, sighandler);
if(chroot(docroot) == -1) if(chroot(docroot) == -1)
die("error: chroot %s: %s\n", docroot, strerror(errno)); die("error: chroot %s: %s\n", docroot, strerror(errno));