summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2009-06-10 22:04:38 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2009-06-10 22:04:38 +0800
commit29580695cf2ceed6b34024946d1fc181c744c34b (patch)
treea6f0d34da2b7b44dbeaf19742bf8126ca7da9515
parentb5e2d75fcf9f4e8a346a01b090d63c70ee9de8c3 (diff)
downloadpttbbs-29580695cf2ceed6b34024946d1fc181c744c34b.tar
pttbbs-29580695cf2ceed6b34024946d1fc181c744c34b.tar.gz
pttbbs-29580695cf2ceed6b34024946d1fc181c744c34b.tar.bz2
pttbbs-29580695cf2ceed6b34024946d1fc181c744c34b.tar.lz
pttbbs-29580695cf2ceed6b34024946d1fc181c744c34b.tar.xz
pttbbs-29580695cf2ceed6b34024946d1fc181c744c34b.tar.zst
pttbbs-29580695cf2ceed6b34024946d1fc181c744c34b.zip
* fix setproctitle behavior difference on Linux (prevent long proc titles)
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4546 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--mbbsd/mbbsd.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/mbbsd/mbbsd.c b/mbbsd/mbbsd.c
index 0ec717a8..c329def7 100644
--- a/mbbsd/mbbsd.c
+++ b/mbbsd/mbbsd.c
@@ -1853,6 +1853,9 @@ tunnel_login(char *argv0, struct ProgramOption *option)
fclose(fp);
}
+ // XXX on Linux, argv0 will change if you setproctitle.
+ strlcpy(buf, argv0, sizeof(buf));
+
/* main loop */
while( 1 )
{
@@ -1882,7 +1885,7 @@ tunnel_login(char *argv0, struct ProgramOption *option)
/* here is only child running */
#ifndef VALGRIND
- snprintf(margs, sizeof(margs), "%s tunnel(%u)-%s ", argv0, pid, dat.port);
+ snprintf(margs, sizeof(margs), "%s tunnel(%u)-%s ", buf, pid, dat.port);
setproctitle("%s: ...login wait... ", margs);
#endif
close(tunnel);