diff options
author | Colin Watson <cjwatson@debian.org> | 2009-12-29 21:38:40 +0000 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2009-12-29 21:38:40 +0000 |
commit | 1b816ea846aca3ee89e7995373ace609e9518424 (patch) | |
tree | b41cdc8495cae7fa9c2e0f98a5f2e71656b61f9a /openbsd-compat/setproctitle.c | |
parent | fa585019a79ebcb4e0202b1c33f87ff1c5c9ce1c (diff) | |
parent | 086ea76990b1e6287c24b6db74adffd4605eb3b0 (diff) |
import openssh-4.6p1-gsskex-20070312.patch
Diffstat (limited to 'openbsd-compat/setproctitle.c')
-rw-r--r-- | openbsd-compat/setproctitle.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/openbsd-compat/setproctitle.c b/openbsd-compat/setproctitle.c index 6e2b19bb4..b511f6649 100644 --- a/openbsd-compat/setproctitle.c +++ b/openbsd-compat/setproctitle.c | |||
@@ -35,10 +35,13 @@ | |||
35 | 35 | ||
36 | #ifndef HAVE_SETPROCTITLE | 36 | #ifndef HAVE_SETPROCTITLE |
37 | 37 | ||
38 | #include <stdarg.h> | ||
39 | #include <stdlib.h> | ||
38 | #include <unistd.h> | 40 | #include <unistd.h> |
39 | #ifdef HAVE_SYS_PSTAT_H | 41 | #ifdef HAVE_SYS_PSTAT_H |
40 | #include <sys/pstat.h> | 42 | #include <sys/pstat.h> |
41 | #endif | 43 | #endif |
44 | #include <string.h> | ||
42 | 45 | ||
43 | #define SPT_NONE 0 /* don't use it at all */ | 46 | #define SPT_NONE 0 /* don't use it at all */ |
44 | #define SPT_PSTAT 1 /* use pstat(PSTAT_SETCMD, ...) */ | 47 | #define SPT_PSTAT 1 /* use pstat(PSTAT_SETCMD, ...) */ |
@@ -80,7 +83,7 @@ compat_init_setproctitle(int argc, char *argv[]) | |||
80 | /* Fail if we can't allocate room for the new environment */ | 83 | /* Fail if we can't allocate room for the new environment */ |
81 | for (i = 0; envp[i] != NULL; i++) | 84 | for (i = 0; envp[i] != NULL; i++) |
82 | ; | 85 | ; |
83 | if ((environ = malloc(sizeof(*environ) * (i + 1))) == NULL) { | 86 | if ((environ = calloc(i + 1, sizeof(*environ))) == NULL) { |
84 | environ = envp; /* put it back */ | 87 | environ = envp; /* put it back */ |
85 | return; | 88 | return; |
86 | } | 89 | } |