From 47fb506da2f1ff00f538ec30120c816ad0eeab37 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 23 Aug 2006 23:20:50 +0000 Subject: r17762: HPUX needs setenv (This used to be commit 535c96f1e7639071d34ea47a88181d861c3a3038) --- source4/lib/ldb/replace/config.m4 | 2 +- source4/lib/ldb/replace/replace.c | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) (limited to 'source4') 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 ]) 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 -- cgit