summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2003-06-03 10:14:28 +1000
committerDamien Miller <djm@mindrot.org>2003-06-03 10:14:28 +1000
commit35276253a60a3e57ec21b82b2e3c81e03c0206de (patch)
tree4552a683045a32f8249d4155b11ce24750d65d30
parenteacbb4fcc1c8baf68db9376f3d6179a30016a36e (diff)
- (djm) Replace setproctitle replacement with code derived from
UCB sendmail
-rw-r--r--ChangeLog6
-rw-r--r--acconfig.h7
-rw-r--r--configure.ac14
-rw-r--r--openbsd-compat/setproctitle.c312
4 files changed, 128 insertions, 211 deletions
diff --git a/ChangeLog b/ChangeLog
index f545802a0..ada1bd2d9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
120030603
2 - (djm) Replace setproctitle replacement with code derived from
3 UCB sendmail
4
120030602 520030602
2 - (djm) Fix segv from bad reordering in auth-pam.c 6 - (djm) Fix segv from bad reordering in auth-pam.c
3 - (djm) Always use saved_argv in sshd.c as compat_init_setproctitle may 7 - (djm) Always use saved_argv in sshd.c as compat_init_setproctitle may
@@ -1644,4 +1648,4 @@
1644 save auth method before monitor_reset_key_state(); bugzilla bug #284; 1648 save auth method before monitor_reset_key_state(); bugzilla bug #284;
1645 ok provos@ 1649 ok provos@
1646 1650
1647$Id: ChangeLog,v 1.2763 2003/06/02 09:10:41 djm Exp $ 1651$Id: ChangeLog,v 1.2764 2003/06/03 00:14:28 djm Exp $
diff --git a/acconfig.h b/acconfig.h
index 7914deb52..9d6008e60 100644
--- a/acconfig.h
+++ b/acconfig.h
@@ -1,4 +1,4 @@
1/* $Id: acconfig.h,v 1.154 2003/05/18 10:52:40 djm Exp $ */ 1/* $Id: acconfig.h,v 1.155 2003/06/03 00:14:28 djm Exp $ */
2 2
3#ifndef _CONFIG_H 3#ifndef _CONFIG_H
4#define _CONFIG_H 4#define _CONFIG_H
@@ -11,6 +11,7 @@
11/* Define to a Set Process Title type if your system is */ 11/* Define to a Set Process Title type if your system is */
12/* supported by bsd-setproctitle.c */ 12/* supported by bsd-setproctitle.c */
13#undef SPT_TYPE 13#undef SPT_TYPE
14#undef SPT_PADCHAR
14 15
15/* setgroups() NOOP allowed */ 16/* setgroups() NOOP allowed */
16#undef SETGROUPS_NOOP 17#undef SETGROUPS_NOOP
@@ -364,10 +365,6 @@
364/* Silly mkstemp() */ 365/* Silly mkstemp() */
365#undef HAVE_STRICT_MKSTEMP 366#undef HAVE_STRICT_MKSTEMP
366 367
367/* Setproctitle emulation */
368#undef SETPROCTITLE_STRATEGY
369#undef SETPROCTITLE_PS_PADDING
370
371/* Some systems put this outside of libc */ 368/* Some systems put this outside of libc */
372#undef HAVE_NANOSLEEP 369#undef HAVE_NANOSLEEP
373 370
diff --git a/configure.ac b/configure.ac
index 83b40188d..21d764f2a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,4 @@
1# $Id: configure.ac,v 1.124 2003/05/30 07:43:42 dtucker Exp $ 1# $Id: configure.ac,v 1.125 2003/06/03 00:14:28 djm Exp $
2 2
3AC_INIT 3AC_INIT
4AC_CONFIG_SRCDIR([ssh.c]) 4AC_CONFIG_SRCDIR([ssh.c])
@@ -86,8 +86,7 @@ case "$host" in
86 dnl AIX handles lastlog as part of its login message 86 dnl AIX handles lastlog as part of its login message
87 AC_DEFINE(DISABLE_LASTLOG) 87 AC_DEFINE(DISABLE_LASTLOG)
88 AC_DEFINE(LOGIN_NEEDS_UTMPX) 88 AC_DEFINE(LOGIN_NEEDS_UTMPX)
89 AC_DEFINE(SETPROCTITLE_STRATEGY,PS_USE_CLOBBER_ARGV) 89 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
90 AC_DEFINE(SETPROCTITLE_PS_PADDING, '\0')
91 ;; 90 ;;
92*-*-cygwin*) 91*-*-cygwin*)
93 check_for_libcrypt_later=1 92 check_for_libcrypt_later=1
@@ -128,7 +127,7 @@ main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
128 AC_DEFINE(LOGIN_NEEDS_UTMPX) 127 AC_DEFINE(LOGIN_NEEDS_UTMPX)
129 AC_DEFINE(DISABLE_SHADOW) 128 AC_DEFINE(DISABLE_SHADOW)
130 AC_DEFINE(DISABLE_UTMP) 129 AC_DEFINE(DISABLE_UTMP)
131 AC_DEFINE(SETPROCTITLE_STRATEGY,PS_USE_PSTAT) 130 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
132 LIBS="$LIBS -lsec -lsecpw" 131 LIBS="$LIBS -lsec -lsecpw"
133 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***])) 132 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
134 disable_ptmx_check=yes 133 disable_ptmx_check=yes
@@ -144,7 +143,7 @@ main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
144 AC_DEFINE(LOGIN_NEEDS_UTMPX) 143 AC_DEFINE(LOGIN_NEEDS_UTMPX)
145 AC_DEFINE(DISABLE_SHADOW) 144 AC_DEFINE(DISABLE_SHADOW)
146 AC_DEFINE(DISABLE_UTMP) 145 AC_DEFINE(DISABLE_UTMP)
147 AC_DEFINE(SETPROCTITLE_STRATEGY,PS_USE_PSTAT) 146 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
148 LIBS="$LIBS -lsec" 147 LIBS="$LIBS -lsec"
149 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***])) 148 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
150 ;; 149 ;;
@@ -157,7 +156,7 @@ main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
157 AC_DEFINE(LOGIN_NEEDS_UTMPX) 156 AC_DEFINE(LOGIN_NEEDS_UTMPX)
158 AC_DEFINE(DISABLE_SHADOW) 157 AC_DEFINE(DISABLE_SHADOW)
159 AC_DEFINE(DISABLE_UTMP) 158 AC_DEFINE(DISABLE_UTMP)
160 AC_DEFINE(SETPROCTITLE_STRATEGY,PS_USE_PSTAT) 159 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
161 LIBS="$LIBS -lsec" 160 LIBS="$LIBS -lsec"
162 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***])) 161 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
163 ;; 162 ;;
@@ -184,8 +183,7 @@ main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
184 check_for_libcrypt_later=1 183 check_for_libcrypt_later=1
185 AC_DEFINE(DONT_TRY_OTHER_AF) 184 AC_DEFINE(DONT_TRY_OTHER_AF)
186 AC_DEFINE(PAM_TTY_KLUDGE) 185 AC_DEFINE(PAM_TTY_KLUDGE)
187 AC_DEFINE(SETPROCTITLE_STRATEGY,PS_USE_CLOBBER_ARGV) 186 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
188 AC_DEFINE(SETPROCTITLE_PS_PADDING, '\0')
189 inet6_default_4in6=yes 187 inet6_default_4in6=yes
190 # openpty can be in libutil, needed for controlling tty test 188 # openpty can be in libutil, needed for controlling tty test
191 AC_SEARCH_LIBS(openpty, util) 189 AC_SEARCH_LIBS(openpty, util)
diff --git a/openbsd-compat/setproctitle.c b/openbsd-compat/setproctitle.c
index 07af7e9c0..24cff0c80 100644
--- a/openbsd-compat/setproctitle.c
+++ b/openbsd-compat/setproctitle.c
@@ -1,41 +1,38 @@
1/* 1/* Based on conf.c from UCB sendmail 8.8.8 */
2 * Based on src/backend/utils/misc/pg_status.c from
3 * PostgreSQL Database Management System
4 *
5 * Portions Copyright (c) 1996-2001, The PostgreSQL Global Development Group
6 *
7 * Portions Copyright (c) 1994, The Regents of the University of California
8 *
9 * Permission to use, copy, modify, and distribute this software and its
10 * documentation for any purpose, without fee, and without a written agreement
11 * is hereby granted, provided that the above copyright notice and this
12 * paragraph and the following two paragraphs appear in all copies.
13 *
14 * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
15 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING
16 * LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS
17 * DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE
18 * POSSIBILITY OF SUCH DAMAGE.
19 *
20 * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
21 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
22 * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
23 * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATIONS TO
24 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
25 */
26 2
27/*-------------------------------------------------------------------- 3/*
28 * ps_status.c 4 * Copyright 2003 Damien Miller
29 * 5 * Copyright (c) 1983, 1995-1997 Eric P. Allman
30 * Routines to support changing the ps display of PostgreSQL backends 6 * Copyright (c) 1988, 1993
31 * to contain some useful information. Mechanism differs wildly across 7 * The Regents of the University of California. All rights reserved.
32 * platforms.
33 * 8 *
34 * $Header: /var/cvs/openssh/openbsd-compat/setproctitle.c,v 1.5 2003/01/20 02:15:11 djm Exp $ 9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
11 * are met:
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
17 * 3. All advertising materials mentioning features or use of this software
18 * must display the following acknowledgement:
19 * This product includes software developed by the University of
20 * California, Berkeley and its contributors.
21 * 4. Neither the name of the University nor the names of its contributors
22 * may be used to endorse or promote products derived from this software
23 * without specific prior written permission.
35 * 24 *
36 * Copyright 2000 by PostgreSQL Global Development Group 25 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
37 * various details abducted from various places 26 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
38 *-------------------------------------------------------------------- 27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 * SUCH DAMAGE.
39 */ 36 */
40 37
41#include "includes.h" 38#include "includes.h"
@@ -44,200 +41,121 @@
44 41
45#include <unistd.h> 42#include <unistd.h>
46#ifdef HAVE_SYS_PSTAT_H 43#ifdef HAVE_SYS_PSTAT_H
47#include <sys/pstat.h> /* for HP-UX */ 44#include <sys/pstat.h>
48#endif
49#ifdef HAVE_PS_STRINGS
50#include <machine/vmparam.h> /* for old BSD */
51#include <sys/exec.h>
52#endif 45#endif
53 46
54/*------ 47#define SPT_NONE 0 /* don't use it at all */
55 * Alternative ways of updating ps display: 48#define SPT_PSTAT 1 /* cover argv with title information */
56 * 49#define SPT_REUSEARGV 2 /* use pstat(PSTAT_SETCMD, ...) */
57 * SETPROCTITLE_STRATEGY == PS_USE_PSTAT
58 * use the pstat(PSTAT_SETCMD, )
59 * (HPUX)
60 * SETPROCTITLE_STRATEGY == PS_USE_PS_STRINGS
61 * assign PS_STRINGS->ps_argvstr = "string"
62 * (some BSD systems)
63 * SETPROCTITLE_STRATEGY == PS_USE_CHANGE_ARGV
64 * assign argv[0] = "string"
65 * (some other BSD systems)
66 * SETPROCTITLE_STRATEGY == PS_USE_CLOBBER_ARGV
67 * write over the argv and environment area
68 * (most SysV-like systems)
69 * SETPROCTITLE_STRATEGY == PS_USE_NONE
70 * don't update ps display
71 * (This is the default, as it is safest.)
72 */
73 50
74#define PS_USE_NONE 0 51#ifndef SPT_TYPE
75#define PS_USE_PSTAT 1 52# define SPT_TYPE SPT_NONE
76#define PS_USE_PS_STRINGS 2
77#define PS_USE_CHANGE_ARGV 3
78#define PS_USE_CLOBBER_ARGV 4
79
80#ifndef SETPROCTITLE_STRATEGY
81# define SETPROCTITLE_STRATEGY PS_USE_NONE
82#endif 53#endif
83 54
84#ifndef SETPROCTITLE_PS_PADDING 55#ifndef SPT_PADCHAR
85# define SETPROCTITLE_PS_PADDING ' ' 56# define SPT_PADCHAR '\0'
86#endif 57#endif
87#endif /* HAVE_SETPROCTITLE */
88 58
89extern char **environ; 59#if SPT_TYPE == SPT_REUSEARGV
90 60static char *argv_start = NULL;
91/* 61static size_t argv_env_len = 0;
92 * argv clobbering uses existing argv space, all other methods need a buffer
93 */
94#if SETPROCTITLE_STRATEGY != PS_USE_CLOBBER_ARGV
95static char ps_buffer[256];
96static const size_t ps_buffer_size = sizeof(ps_buffer);
97#else
98static char *ps_buffer; /* will point to argv area */
99static size_t ps_buffer_size; /* space determined at run time */
100#endif 62#endif
101 63
102/* save the original argv[] location here */ 64#endif /* HAVE_SETPROCTITLE */
103static int save_argc;
104static char **save_argv;
105
106extern char *__progname;
107 65
108#ifndef HAVE_SETPROCTITLE
109/*
110 * Call this to update the ps status display to a fixed prefix plus an
111 * indication of what you're currently doing passed in the argument.
112 */
113void 66void
114setproctitle(const char *fmt, ...) 67compat_init_setproctitle(int argc, char *argv[])
115{ 68{
116#if SETPROCTITLE_STRATEGY == PS_USE_PSTAT 69#if SPT_TYPE == SPT_REUSEARGV
117 union pstun pst; 70 extern char **environ;
118#endif 71 char *lastargv = NULL;
119#if SETPROCTITLE_STRATEGY != PS_USE_NONE 72 char **envp = environ;
120 ssize_t used; 73 int i;
121 va_list ap;
122
123 /* no ps display if you didn't call save_ps_display_args() */
124 if (save_argv == NULL)
125 return;
126#if SETPROCTITLE_STRATEGY == PS_USE_CLOBBER_ARGV
127 /* If ps_buffer is a pointer, it might still be null */
128 if (ps_buffer == NULL)
129 return;
130#endif /* PS_USE_CLOBBER_ARGV */
131 74
132 /* 75 /*
133 * Overwrite argv[] to point at appropriate space, if needed 76 * NB: This assumes that argv has already been copied out of the
77 * way. This is true for sshd, but may not be true for other
78 * programs. Beware.
134 */ 79 */
135#if SETPROCTITLE_STRATEGY == PS_USE_CHANGE_ARGV
136 save_argv[0] = ps_buffer;
137 save_argv[1] = NULL;
138#endif /* PS_USE_CHANGE_ARGV */
139 80
140#if SETPROCTITLE_STRATEGY == PS_USE_CLOBBER_ARGV 81 if (argc == 0 || argv[0] == NULL)
141 save_argv[1] = NULL; 82 return;
142#endif /* PS_USE_CLOBBER_ARGV */ 83
84 /* Fail if we can't allocate room for the new environment */
85 for (i = 0; envp[i] != NULL; i++)
86 ;
87 if ((environ = malloc(sizeof(*environ) * (i + 1))) == NULL) {
88 environ = envp; /* put it back */
89 return;
90 }
143 91
144 /* 92 /*
145 * Make fixed prefix of ps display. 93 * Find the last argv string or environment variable within
94 * our process memory area.
146 */ 95 */
147 96 for (i = 0; i < argc; i++) {
148 va_start(ap, fmt); 97 if (lastargv == NULL || lastargv + 1 == argv[i])
149 if (fmt == NULL) 98 lastargv = argv[i] + strlen(argv[i]);
150 snprintf(ps_buffer, ps_buffer_size, "%s", __progname); 99 }
151 else { 100 for (i = 0; envp[i] != NULL; i++) {
152 used = snprintf(ps_buffer, ps_buffer_size, "%s: ", __progname); 101 if (lastargv + 1 == envp[i])
153 if (used == -1 || used >= ps_buffer_size) 102 lastargv = envp[i] + strlen(envp[i]);
154 used = ps_buffer_size;
155 vsnprintf(ps_buffer + used, ps_buffer_size - used, fmt, ap);
156 } 103 }
157 va_end(ap);
158
159#if SETPROCTITLE_STRATEGY == PS_USE_PSTAT
160 pst.pst_command = ps_buffer;
161 pstat(PSTAT_SETCMD, pst, strlen(ps_buffer), 0, 0);
162#endif /* PS_USE_PSTAT */
163
164#if SETPROCTITLE_STRATEGY == PS_USE_PS_STRINGS
165 PS_STRINGS->ps_nargvstr = 1;
166 PS_STRINGS->ps_argvstr = ps_buffer;
167#endif /* PS_USE_PS_STRINGS */
168 104
169#if SETPROCTITLE_STRATEGY == PS_USE_CLOBBER_ARGV 105 argv[1] = NULL;
170 /* pad unused memory */ 106 argv_start = argv[0];
171 used = strlen(ps_buffer); 107 argv_env_len = lastargv - argv[0] - 1;
172 memset(ps_buffer + used, SETPROCTITLE_PS_PADDING,
173 ps_buffer_size - used);
174#endif /* PS_USE_CLOBBER_ARGV */
175 108
176#endif /* PS_USE_NONE */ 109 /*
110 * Copy environment
111 * XXX - will truncate env on strdup fail
112 */
113 for (i = 0; envp[i] != NULL; i++)
114 environ[i] = strdup(envp[i]);
115 environ[i] = NULL;
116#endif /* SPT_REUSEARGV */
177} 117}
178 118
179#endif /* HAVE_SETPROCTITLE */ 119#ifndef HAVE_SETPROCTITLE
180
181/*
182 * Call this early in startup to save the original argc/argv values.
183 *
184 * argv[] will not be overwritten by this routine, but may be overwritten
185 * during setproctitle. Also, the physical location of the environment
186 * strings may be moved, so this should be called before any code that
187 * might try to hang onto a getenv() result.
188 */
189void 120void
190compat_init_setproctitle(int argc, char *argv[]) 121setproctitle(const char *fmt, ...)
191{ 122{
192#if SETPROCTITLE_STRATEGY == PS_USE_CLOBBER_ARGV 123#if SPT_TYPE != SPT_NONE
193 char *end_of_area = NULL; 124 va_list ap;
194 char **new_environ; 125 char buf[1024];
195 int i; 126 size_t len;
127 extern char *__progname;
128#if SPT_TYPE == SPT_PSTAT
129 union pstun pst;
196#endif 130#endif
197 131
198 save_argc = argc; 132#if SPT_TYPE == SPT_REUSEARGV
199 save_argv = argv; 133 if (argv_env_len <= 0)
200
201#if SETPROCTITLE_STRATEGY == PS_USE_CLOBBER_ARGV
202 /*
203 * If we're going to overwrite the argv area, count the available
204 * space. Also move the environment to make additional room.
205 */
206
207 /*
208 * check for contiguous argv strings
209 */
210 for (i = 0; i < argc; i++) {
211 if (i == 0 || end_of_area + 1 == argv[i])
212 end_of_area = argv[i] + strlen(argv[i]);
213 }
214
215 /* probably can't happen? */
216 if (end_of_area == NULL) {
217 ps_buffer = NULL;
218 ps_buffer_size = 0;
219 return; 134 return;
220 } 135#endif
221 136
222 /* 137 strlcpy(buf, __progname, sizeof(buf));
223 * check for contiguous environ strings following argv 138
224 */ 139 va_start(ap, fmt);
225 for (i = 0; environ[i] != NULL; i++) { 140 if (fmt != NULL) {
226 if (end_of_area + 1 == environ[i]) 141 len = strlcat(buf, ": ", sizeof(buf));
227 end_of_area = environ[i] + strlen(environ[i]); 142 if (len < sizeof(buf))
143 vsnprintf(buf + len, sizeof(buf) - len , fmt, ap);
228 } 144 }
145 va_end(ap);
229 146
230 ps_buffer = argv[0]; 147#if SPT_TYPE == SPT_PSTAT
231 ps_buffer_size = end_of_area - argv[0] - 1; 148 pst.pst_command = buf;
149 pstat(PSTAT_SETCMD, pst, strlen(buf), 0, 0);
150#elif SPT_TYPE == SPT_REUSEARGV
151/* debug("setproctitle: copy \"%s\" into len %d",
152 buf, argv_env_len); */
153 len = strlcpy(argv_start, buf, argv_env_len);
154 for(; len < argv_env_len; len++)
155 argv_start[len] = SPT_PADCHAR;
156#endif
232 157
233 /* 158#endif /* SPT_NONE */
234 * Duplicate and move the environment out of the way
235 */
236 new_environ = malloc(sizeof(char *) * (i + 1));
237 for (i = 0; environ[i] != NULL; i++)
238 new_environ[i] = strdup(environ[i]);
239 new_environ[i] = NULL;
240 environ = new_environ;
241#endif /* PS_USE_CLOBBER_ARGV */
242} 159}
243 160
161#endif /* HAVE_SETPROCTITLE */