summaryrefslogtreecommitdiffstats
path: root/mbbsd
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2009-06-12 01:38:10 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2009-06-12 01:38:10 +0800
commit8f7f3962f7a4770e9139d0514deed2eb36c6af88 (patch)
treeb2f507dc47d6994b2342d1a52290d0fc9462f7d2 /mbbsd
parentb2b25a5c967cfb01a70efc575f4bbd5f734e537a (diff)
downloadpttbbs-8f7f3962f7a4770e9139d0514deed2eb36c6af88.tar
pttbbs-8f7f3962f7a4770e9139d0514deed2eb36c6af88.tar.gz
pttbbs-8f7f3962f7a4770e9139d0514deed2eb36c6af88.tar.bz2
pttbbs-8f7f3962f7a4770e9139d0514deed2eb36c6af88.tar.lz
pttbbs-8f7f3962f7a4770e9139d0514deed2eb36c6af88.tar.xz
pttbbs-8f7f3962f7a4770e9139d0514deed2eb36c6af88.tar.zst
pttbbs-8f7f3962f7a4770e9139d0514deed2eb36c6af88.zip
* allow tunnel/port daemon mode to run within one command.
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4567 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd')
-rw-r--r--mbbsd/mbbsd.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/mbbsd/mbbsd.c b/mbbsd/mbbsd.c
index ed4706b1..5f27d0bd 100644
--- a/mbbsd/mbbsd.c
+++ b/mbbsd/mbbsd.c
@@ -1768,6 +1768,24 @@ bool parse_argv(int argc, char *argv[], struct ProgramOption *option)
}
}
+ if ( option->tunnel_mode && option->nport)
+ {
+ // should we do so?
+ signal_restart(SIGCHLD, reapchild);
+
+ // dual mode: we need to fork.
+ if (fork() == 0)
+ {
+ // ports daemon
+ option->tunnel_mode = false;
+ free(option->flag_tunnel_path);
+ option->flag_tunnel_path = NULL;
+ } else {
+ // tunnel mode daemon
+ option->nport = 0;
+ }
+ }
+
if ( option->tunnel_mode && option->nport != 0) {
fprintf(stderr, "you cannot bind ports port in tunnel mode.\n");
return false;