diff --git a/ircd/ircd.c b/ircd/ircd.c index de8e80a4..4e5093fc 100644 --- a/ircd/ircd.c +++ b/ircd/ircd.c @@ -225,6 +225,12 @@ make_daemon(void) we need control over the parent after forking to print the startup message -- Aaron */ + if((nullfd = open("/dev/null", O_RDWR)) < 0) + { + perror("open /dev/null"); + exit(EXIT_FAILURE); + } + if((pid = fork()) < 0) { perror("fork"); @@ -238,12 +244,6 @@ make_daemon(void) exit(EXIT_SUCCESS); } - if((nullfd = open("/dev/null", O_RDWR)) < 0) - { - perror("open /dev/null"); - exit(EXIT_FAILURE); - } - for(fdx = 0; fdx <= 2; fdx++) if (fdx != nullfd) (void) dup2(nullfd, fdx);