]> andersk Git - openssh.git/blobdiff - openbsd-compat/setproctitle.c
- tdeval@cvs.openbsd.org 2004/11/24 18:10:42
[openssh.git] / openbsd-compat / setproctitle.c
index 6e2b19bb4f584c50069196db7a6b4d0066b5d4ca..b511f6649650084d12d025a0801479f9ec8835a3 100644 (file)
 
 #ifndef HAVE_SETPROCTITLE
 
+#include <stdarg.h>
+#include <stdlib.h>
 #include <unistd.h>
 #ifdef HAVE_SYS_PSTAT_H
 #include <sys/pstat.h>
 #endif
+#include <string.h>
 
 #define SPT_NONE       0       /* don't use it at all */
 #define SPT_PSTAT      1       /* use pstat(PSTAT_SETCMD, ...) */
@@ -80,7 +83,7 @@ compat_init_setproctitle(int argc, char *argv[])
        /* Fail if we can't allocate room for the new environment */
        for (i = 0; envp[i] != NULL; i++)
                ;
-       if ((environ = malloc(sizeof(*environ) * (i + 1))) == NULL) {
+       if ((environ = calloc(i + 1, sizeof(*environ))) == NULL) {
                environ = envp; /* put it back */
                return;
        }
This page took 0.026878 seconds and 4 git commands to generate.