From 1726f9fb75262762e0ab47a6c0eeee05021f125c Mon Sep 17 00:00:00 2001 From: piaip Date: Tue, 16 Jun 2009 15:47:47 +0000 Subject: * fix: incorrect pid in procname git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4641 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- mbbsd/mbbsd.c | 5 +++-- 1 file 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); } -- cgit v1.2.3