diff options
Diffstat (limited to 'openbsd-compat/setproctitle.c')
-rw-r--r-- | openbsd-compat/setproctitle.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/openbsd-compat/setproctitle.c b/openbsd-compat/setproctitle.c index 9f7ca14c..e4064323 100644 --- a/openbsd-compat/setproctitle.c +++ b/openbsd-compat/setproctitle.c @@ -36,6 +36,7 @@ #ifndef HAVE_SETPROCTITLE #include <stdarg.h> +#include <stdio.h> #include <stdlib.h> #include <unistd.h> #ifdef HAVE_SYS_PSTAT_H @@ -76,7 +77,7 @@ compat_init_setproctitle(int argc, char *argv[]) /* * NB: This assumes that argv has already been copied out of the - * way. This is true for sshd, but may not be true for other + * way. This is true for sshd, but may not be true for other * programs. Beware. */ @@ -92,7 +93,7 @@ compat_init_setproctitle(int argc, char *argv[]) } /* - * Find the last argv string or environment variable within + * Find the last argv string or environment variable within * our process memory area. */ for (i = 0; i < argc; i++) { @@ -108,8 +109,8 @@ compat_init_setproctitle(int argc, char *argv[]) argv_start = argv[0]; argv_env_len = lastargv - argv[0] - 1; - /* - * Copy environment + /* + * Copy environment * XXX - will truncate env on strdup fail */ for (i = 0; envp[i] != NULL; i++) @@ -125,7 +126,7 @@ setproctitle(const char *fmt, ...) #if SPT_TYPE != SPT_NONE va_list ap; char buf[1024], ptitle[1024]; - size_t len; + size_t len = 0; int r; extern char *__progname; #if SPT_TYPE == SPT_PSTAT @@ -156,7 +157,7 @@ setproctitle(const char *fmt, ...) pst.pst_command = ptitle; pstat(PSTAT_SETCMD, pst, strlen(ptitle), 0, 0); #elif SPT_TYPE == SPT_REUSEARGV -/* debug("setproctitle: copy \"%s\" into len %d", +/* debug("setproctitle: copy \"%s\" into len %d", buf, argv_env_len); */ len = strlcpy(argv_start, ptitle, argv_env_len); for(; len < argv_env_len; len++) |