summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2003-04-14 15:47:54 +0800
committerin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2003-04-14 15:47:54 +0800
commitd161b47e078c6d5627d0d0cdd7b49f391ac42fce (patch)
treeb358f4c531d700781c73c48267cdfaa918b5c403
parent348f31f472f9aea2fcd53c20cad0e77c67870d8d (diff)
downloadpttbbs-d161b47e078c6d5627d0d0cdd7b49f391ac42fce.tar
pttbbs-d161b47e078c6d5627d0d0cdd7b49f391ac42fce.tar.gz
pttbbs-d161b47e078c6d5627d0d0cdd7b49f391ac42fce.tar.bz2
pttbbs-d161b47e078c6d5627d0d0cdd7b49f391ac42fce.tar.lz
pttbbs-d161b47e078c6d5627d0d0cdd7b49f391ac42fce.tar.xz
pttbbs-d161b47e078c6d5627d0d0cdd7b49f391ac42fce.tar.zst
pttbbs-d161b47e078c6d5627d0d0cdd7b49f391ac42fce.zip
open /dev/null to fd:2 (stderr)
git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@790 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--mbbsd/mbbsd.c11
1 files 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