diff options
Diffstat (limited to 'bsd-misc.c')
-rw-r--r-- | bsd-misc.c | 24 |
1 files changed, 0 insertions, 24 deletions
diff --git a/bsd-misc.c b/bsd-misc.c index 83cb0b85d..dd1f6a476 100644 --- a/bsd-misc.c +++ b/bsd-misc.c | |||
@@ -139,30 +139,6 @@ void setproctitle(const char *fmt, ...) | |||
139 | } | 139 | } |
140 | #endif /* !HAVE_SETPROCTITLE */ | 140 | #endif /* !HAVE_SETPROCTITLE */ |
141 | 141 | ||
142 | #ifndef HAVE_SETENV | ||
143 | int setenv(const char *name, const char *value, int overwrite) | ||
144 | { | ||
145 | char *env_string; | ||
146 | int result; | ||
147 | |||
148 | /* Don't overwrite existing env. var if overwrite is 0 */ | ||
149 | if (!overwrite && (getenv(name) != NULL)) | ||
150 | return(0); | ||
151 | |||
152 | env_string = xmalloc(strlen(name) + strlen(value) + 2); | ||
153 | sprintf(env_string, "%s=%s", name, value); | ||
154 | |||
155 | result = putenv(env_string); | ||
156 | |||
157 | /* Putenv doesn't copy the env_string, so we need to keep a copy of it */ | ||
158 | /* around. This leaks a bit of memory, but it doesn't matter */ | ||
159 | /* for our (OpenSSH port ) use: setenv is only used twice in ssh-agent */ | ||
160 | /* xfree(env_string); */ | ||
161 | |||
162 | return(result); | ||
163 | } | ||
164 | #endif /* !HAVE_SETENV */ | ||
165 | |||
166 | #ifndef HAVE_SETLOGIN | 142 | #ifndef HAVE_SETLOGIN |
167 | int setlogin(const char *name) | 143 | int setlogin(const char *name) |
168 | { | 144 | { |