summaryrefslogtreecommitdiffstats
path: root/mbbsd/mbbsd.c
diff options
context:
space:
mode:
authorin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2003-03-28 22:15:20 +0800
committerin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2003-03-28 22:15:20 +0800
commit91fef437949c915b8666265b737f41263eda22bd (patch)
tree058f03b2bdbc0253d96b4f90d4f3e098ae04c2d6 /mbbsd/mbbsd.c
parent498c803bd9ecf9f48cc28dc194869b7fbcf5a32b (diff)
downloadpttbbs-91fef437949c915b8666265b737f41263eda22bd.tar
pttbbs-91fef437949c915b8666265b737f41263eda22bd.tar.gz
pttbbs-91fef437949c915b8666265b737f41263eda22bd.tar.bz2
pttbbs-91fef437949c915b8666265b737f41263eda22bd.tar.lz
pttbbs-91fef437949c915b8666265b737f41263eda22bd.tar.xz
pttbbs-91fef437949c915b8666265b737f41263eda22bd.tar.zst
pttbbs-91fef437949c915b8666265b737f41263eda22bd.zip
PRE_FORK
git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@741 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/mbbsd.c')
-rw-r--r--mbbsd/mbbsd.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/mbbsd/mbbsd.c b/mbbsd/mbbsd.c
index 00e4fa7a..97ba847a 100644
--- a/mbbsd/mbbsd.c
+++ b/mbbsd/mbbsd.c
@@ -1,4 +1,4 @@
-/* $Id: mbbsd.c,v 1.68 2003/03/24 10:28:24 in2 Exp $ */
+/* $Id: mbbsd.c,v 1.69 2003/03/28 14:15:20 in2 Exp $ */
#include "bbs.h"
#define SOCKET_QLEN 4
@@ -1256,7 +1256,18 @@ daemon_login(int argc, char *argv[], char *envp[])
setuid(BBSUID);
chdir(BBSHOME);
- snprintf(buf, sizeof(buf), "run/mbbsd.%d.pid", listen_port);
+#ifndef NO_FORK
+#ifdef PRE_FORK
+ if( listen_port == 23 ){ // only pre-fork in port 23
+ int i;
+ for( i = 0 ; i < PRE_FORK ; ++i )
+ if( fork() <= 0 )
+ break;
+ }
+#endif
+#endif
+
+ snprintf(buf, sizeof(buf), "run/mbbsd.%d.%d.pid", listen_port, getpid());
if ((fp = fopen(buf, "w"))) {
fprintf(fp, "%d\n", getpid());
fclose(fp);