aboutsummaryrefslogtreecommitdiffstats
path: root/missing
diff options
context:
space:
mode:
Diffstat (limited to 'missing')
-rw-r--r--missing/setproctitle.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/missing/setproctitle.c b/missing/setproctitle.c
index 9dcf37560b..602ddf105c 100644
--- a/missing/setproctitle.c
+++ b/missing/setproctitle.c
@@ -74,6 +74,7 @@
static char *argv_start = NULL;
static size_t argv_env_len = 0;
static size_t argv_len = 0;
+static char **argv1_addr = NULL;
#endif
#endif /* HAVE_SETPROCTITLE */
@@ -119,7 +120,9 @@ compat_init_setproctitle(int argc, char *argv[])
lastenvp = envp[i] + strlen(envp[i]);
}
- argv[1] = NULL;
+ /* We keep argv[1], argv[2], etc. at this moment,
+ because the ps command of AIX refers to them. */
+ argv1_addr = &argv[1];
argv_start = argv[0];
argv_len = lastargv - argv[0];
argv_env_len = lastenvp - argv[0];
@@ -162,6 +165,8 @@ setproctitle(const char *fmt, ...)
argvlen = len > argv_len ? argv_env_len : argv_len;
for(; len < argvlen; len++)
argv_start[len] = SPT_PADCHAR;
+ /* argv[1], argv[2], etc. are no longer valid. */
+ *argv1_addr = NULL;
#endif
#endif /* SPT_NONE */