summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2009-06-16 23:47:47 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2009-06-16 23:47:47 +0800
commit1726f9fb75262762e0ab47a6c0eeee05021f125c (patch)
tree744521bca7b59e3687a6c549986e497729cda600
parent69e7169392592a6a6cf06f98e53e5f907bedc317 (diff)
downloadpttbbs-1726f9fb75262762e0ab47a6c0eeee05021f125c.tar
pttbbs-1726f9fb75262762e0ab47a6c0eeee05021f125c.tar.gz
pttbbs-1726f9fb75262762e0ab47a6c0eeee05021f125c.tar.bz2
pttbbs-1726f9fb75262762e0ab47a6c0eeee05021f125c.tar.lz
pttbbs-1726f9fb75262762e0ab47a6c0eeee05021f125c.tar.xz
pttbbs-1726f9fb75262762e0ab47a6c0eeee05021f125c.tar.zst
pttbbs-1726f9fb75262762e0ab47a6c0eeee05021f125c.zip
* fix: incorrect pid in procname
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4641 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--mbbsd/mbbsd.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/mbbsd/mbbsd.c b/mbbsd/mbbsd.c
index 3206ed86..43317efe 100644
--- a/mbbsd/mbbsd.c
+++ b/mbbsd/mbbsd.c
@@ -1930,13 +1930,14 @@ static int
tunnel_login(char *argv0, struct ProgramOption *option)
{
int tunnel = 0, csock = 0;
- unsigned int pid = (unsigned int)getpid();
+ unsigned int pid;
struct login_data dat = {0};
char buf[PATHLEN];
FILE *fp;
/* setup standalone */
start_daemon(option);
+ pid = (unsigned int)getpid(); // the pid will be changed after start_daemon.
signal_restart(SIGCHLD, reapchild);
assert( option->flag_tunnel_path &&
@@ -1959,7 +1960,7 @@ tunnel_login(char *argv0, struct ProgramOption *option)
snprintf(buf, sizeof(buf),
"run/mbbsd.%s.%u.pid", "tunnel",pid);
if ((fp = fopen(buf, "w"))) {
- fprintf(fp, "%d\n", (int)getpid());
+ fprintf(fp, "%u\n", pid);
fclose(fp);
}