mirror of
git://anongit.mindrot.org/openssh.git
synced 2024-11-23 18:23:25 +08:00
- Added a setenv replacement for systems which lack it
This commit is contained in:
parent
d71b12ee5b
commit
d770252d3a
@ -13,6 +13,7 @@
|
||||
- Fix EGD problems (Thanks to Ben Taylor <bent@clark.net>)
|
||||
- Retry /dev/urandom reads interrupted by signal (report from
|
||||
Robert Hardy <rhardy@webcon.net>)
|
||||
- Added a setenv replacement for systems which lack it
|
||||
|
||||
19991121
|
||||
- OpenBSD CVS Changes:
|
||||
|
@ -58,7 +58,7 @@ dnl Checks for header files.
|
||||
AC_CHECK_HEADERS(pty.h endian.h paths.h lastlog.h shadow.h netgroup.h maillock.h sys/select.h sys/time.h)
|
||||
|
||||
dnl Checks for library functions.
|
||||
AC_CHECK_FUNCS(openpty strlcpy strlcat mkdtemp arc4random setproctitle setlogin)
|
||||
AC_CHECK_FUNCS(openpty strlcpy strlcat mkdtemp arc4random setproctitle setlogin setenv)
|
||||
|
||||
AC_CHECK_FUNC(login,
|
||||
[AC_DEFINE(HAVE_LOGIN)],
|
||||
|
21
helper.c
21
helper.c
@ -149,3 +149,24 @@ void setproctitle(const char *fmt, ...)
|
||||
/* FIXME */
|
||||
}
|
||||
#endif /* !HAVE_SETPROCTITLE */
|
||||
|
||||
#ifndef HAVE_SETENV
|
||||
int setenv(const char *name, const char *value, int overwrite)
|
||||
{
|
||||
char *env_string;
|
||||
int result;
|
||||
|
||||
/* Don't overwrite existing env. var if overwrite is 0 */
|
||||
if (!overwrite && (getenv(name) != NULL))
|
||||
return(0);
|
||||
|
||||
env_string = xmalloc(strlen(name) + strlen(value) + 2);
|
||||
sprintf(env_string, "%s=%s", name, value);
|
||||
|
||||
result = putenv(env_string);
|
||||
|
||||
xfree(env_string);
|
||||
|
||||
return(result);
|
||||
}
|
||||
#endif /* !HAVE_SETENV */
|
||||
|
Loading…
Reference in New Issue
Block a user