summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/replace/replace.c
diff options
context:
space:
mode:
Diffstat (limited to 'source4/lib/ldb/replace/replace.c')
-rw-r--r--source4/lib/ldb/replace/replace.c17
1 files changed, 17 insertions, 0 deletions
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