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
commita7c8d082210c59eaf4478e80d207c304a79b9814 (patch)
tree08e55b8505f22387dc0fe0942563fdb71f44acb5
parentf765253b7ae046e7bda5ee8c13903d3c22ab9302 (diff)
downloadpttbbs-a7c8d082210c59eaf4478e80d207c304a79b9814.tar
pttbbs-a7c8d082210c59eaf4478e80d207c304a79b9814.tar.gz
pttbbs-a7c8d082210c59eaf4478e80d207c304a79b9814.tar.bz2
pttbbs-a7c8d082210c59eaf4478e80d207c304a79b9814.tar.lz
pttbbs-a7c8d082210c59eaf4478e80d207c304a79b9814.tar.xz
pttbbs-a7c8d082210c59eaf4478e80d207c304a79b9814.tar.zst
pttbbs-a7c8d082210c59eaf4478e80d207c304a79b9814.zip
* fix setproctitle behavior difference on Linux (prevent long proc titles)
git-svn-id: http://opensvn.csie.org/pttbbs/trunk@4546 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--pttbbs/mbbsd/mbbsd.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/pttbbs/mbbsd/mbbsd.c b/pttbbs/mbbsd/mbbsd.c
index 0ec717a8..c329def7 100644
--- a/pttbbs/mbbsd/mbbsd.c
+++ b/pttbbs/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);