summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2006-08-23 23:20:50 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:16:38 -0500
commit47fb506da2f1ff00f538ec30120c816ad0eeab37 (patch)
tree09bceda524eee7fc7c02e5e12ffd8135b6f2f372
parent48c7cfcb749f2df1500339c1046854721f8a1a7e (diff)
downloadsamba-47fb506da2f1ff00f538ec30120c816ad0eeab37.tar.gz
samba-47fb506da2f1ff00f538ec30120c816ad0eeab37.tar.bz2
samba-47fb506da2f1ff00f538ec30120c816ad0eeab37.zip
r17762: HPUX needs setenv
(This used to be commit 535c96f1e7639071d34ea47a88181d861c3a3038)
-rw-r--r--source4/lib/ldb/replace/config.m42
-rw-r--r--source4/lib/ldb/replace/replace.c17
2 files changed, 18 insertions, 1 deletions
diff --git a/source4/lib/ldb/replace/config.m4 b/source4/lib/ldb/replace/config.m4
index ebc2568658..2d21d1b315 100644
--- a/source4/lib/ldb/replace/config.m4
+++ b/source4/lib/ldb/replace/config.m4
@@ -5,7 +5,7 @@ AC_CHECK_TYPE(uint64_t, unsigned long long)
AC_CHECK_TYPE(comparison_fn_t,
[AC_DEFINE(HAVE_COMPARISON_FN_T, 1,[Whether or not we have comparison_fn_t])])
-AC_CHECK_FUNCS(strerror timegm strnlen)
+AC_CHECK_FUNCS(strerror timegm strnlen setenv)
AC_CHECK_FUNCS(strtoull __strtoull strtouq strtoll __strtoll strtoq)
AC_HAVE_DECL(errno, [#include <errno.h>])
diff --git a/source4/lib/ldb/replace/replace.c b/source4/lib/ldb/replace/replace.c
index 2c2068f8f4..e2df7fe363 100644
--- a/source4/lib/ldb/replace/replace.c
+++ b/source4/lib/ldb/replace/replace.c
@@ -67,3 +67,20 @@
}
#endif
+#ifndef HAVE_SETENV
+ int setenv(const char *name, const char *value, int overwrite)
+{
+ char *p = NULL;
+ int ret = -1;
+
+ asprintf(&p, "%s=%s", name, value);
+
+ if (overwrite || getenv(name)) {
+ if (p) ret = putenv(p);
+ } else {
+ ret = 0;
+ }
+
+ return ret;
+}
+#endif