From d161b47e078c6d5627d0d0cdd7b49f391ac42fce Mon Sep 17 00:00:00 2001 From: in2 Date: Mon, 14 Apr 2003 07:47:54 +0000 Subject: open /dev/null to fd:2 (stderr) git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@790 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- mbbsd/mbbsd.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/mbbsd/mbbsd.c b/mbbsd/mbbsd.c index 6eade791..ef35cfe9 100644 --- a/mbbsd/mbbsd.c +++ b/mbbsd/mbbsd.c @@ -1,4 +1,4 @@ -/* $Id: mbbsd.c,v 1.70 2003/04/07 08:08:47 in2 Exp $ */ +/* $Id: mbbsd.c,v 1.71 2003/04/14 07:47:54 in2 Exp $ */ #include "bbs.h" #define SOCKET_QLEN 4 @@ -32,7 +32,7 @@ signal_restart(int signum, void (*handler) (int)) static void start_daemon() { - int n; + int n, fd; char buf[80]; /* @@ -56,6 +56,13 @@ start_daemon() n = getdtablesize(); while (n) close(--n); + + /* in2: open /dev/null to fd:2 */ + if( ((fd = open("/dev/null", O_WRONLY)) >= 0) && fd != 2 ){ + dup2(fd, 2); + close(fd); + } + /* * rocker.011018: we don't need to remember original tty, so request a * new session id -- cgit v1.2.3