]> andersk Git - openssh.git/commitdiff
- Added a setenv replacement for systems which lack it
authordamien <damien>
Mon, 22 Nov 1999 05:11:05 +0000 (05:11 +0000)
committerdamien <damien>
Mon, 22 Nov 1999 05:11:05 +0000 (05:11 +0000)
ChangeLog
configure.in
helper.c
helper.h

index d7ea7b761a5e7c0be6ea285327ac9dd1e09a1cda..0f069dfd12089e80a88edfa883dc5b23b4cdaef6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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:
index 0678fa4c8f5b634772b85a3b5ae3ac8e687b283f..a831b92102238877cabbbd4dd17c2af82b3b4710 100644 (file)
@@ -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)],
index 47e797b6c17b93aa7d247ca374aee0a67bdb47ca..91a78b5776d48f6fcc3b08d721cc7b3994977270 100644 (file)
--- a/helper.c
+++ b/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 */
index 0e53fac4379d891f56ef8fb2304b6734fe37469b..68e0a85309357943481189c0d23283d36d3ac03c 100644 (file)
--- a/helper.h
+++ b/helper.h
@@ -47,4 +47,8 @@ void arc4random_stir(void);
 void setproctitle(const char *fmt, ...);
 #endif /* !HAVE_SETPROCTITLE */
 
+#ifndef HAVE_SETENV
+int setenv(const char *name, const char *value, int overwrite);
+#endif /* !HAVE_SETENV */
+
 #endif /* _HELPER_H */
This page took 0.048597 seconds and 5 git commands to generate.