summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHeiko Schlittermann (HS12-RIPE) <hs@schlittermann.de>2016-03-23 21:19:56 +0100
committerHeiko Schlittermann (HS12-RIPE) <hs@schlittermann.de>2016-03-23 21:51:55 +0100
commit271019bd0730f90f81d44ea0946707588df242d6 (patch)
tree70b2ae1fd7cccf693df9e1f42c4f8e3f63a5c51f /src
parenteac732adbd59b15f10f4db14414dd1405b488e65 (diff)
Add os_unsetenv()
BSDI: void unsetenv(const char*) Other: int unsetenv(const char*)
Diffstat (limited to 'src')
-rw-r--r--src/OS/os.c-BSDI19
-rw-r--r--src/OS/os.h-BSDI1
-rw-r--r--src/src/environment.c2
-rw-r--r--src/src/os.c18
-rw-r--r--src/src/osfunctions.h3
-rw-r--r--src/src/tls.c6
6 files changed, 44 insertions, 5 deletions
diff --git a/src/OS/os.c-BSDI b/src/OS/os.c-BSDI
new file mode 100644
index 000000000..43e5bb147
--- /dev/null
+++ b/src/OS/os.c-BSDI
@@ -0,0 +1,19 @@
+/*************************************************
+* Exim - an Internet mail transport agent *
+*************************************************/
+
+/* Copyright (c) 2016 Heiko Schlittermann <hs@schlittermann.de> */
+/* See the file NOTICE for conditions of use and distribution. */
+
+/* BSDI-specific code. This is concatenated onto the generic
+src/os.c file. */
+
+#ifndef OS_UNSETENV
+#define OS_UNSETENV
+
+int
+os_unsetenv(const char *name)
+{
+ unsetenv(name);
+ return 0;
+}
diff --git a/src/OS/os.h-BSDI b/src/OS/os.h-BSDI
index 6e16722fd..a1705ec95 100644
--- a/src/OS/os.h-BSDI
+++ b/src/OS/os.h-BSDI
@@ -5,6 +5,7 @@
#define HAVE_MMAP
#define HAVE_SYS_MOUNT_H
#define SIOCGIFCONF_GIVES_ADDR
+#define OS_UNSETENV
typedef struct flock flock_t;
diff --git a/src/src/environment.c b/src/src/environment.c
index 8542dc0d2..b768a0fd6 100644
--- a/src/src/environment.c
+++ b/src/src/environment.c
@@ -51,7 +51,7 @@ else if (Ustrcmp(keep_environment, "*") != 0)
uschar *name = string_copyn(*p, eqp - *p);
if (OK != match_isinlist(name, CUSS &keep_environment,
0, NULL, NULL, MCL_NOEXPAND, FALSE, NULL))
- if (unsetenv(CS name) < 0) return FALSE;
+ if (os_unsetenv(name) < 0) return FALSE;
else p = USS environ; /* RESTART from the beginning */
else p++;
store_reset(name);
diff --git a/src/src/os.c b/src/src/os.c
index ee754f9f2..d9ca589ee 100644
--- a/src/src/os.c
+++ b/src/src/os.c
@@ -833,9 +833,25 @@ os_get_dns_resolver_res(void)
#endif /* OS_GET_DNS_RESOLVER_RES */
-
/* ----------------------------------------------------------------------- */
+/***********************************************************
+* unsetenv() *
+***********************************************************/
+
+/* Most modern systems define int unsetenv(const char*),
+* some don't. */
+
+#if !defined(OS_UNSETENV)
+int
+os_unsetenv(const char *name)
+{
+ return unsetenv(name);
+}
+#endif
+
+
+/* ----------------------------------------------------------------------- */
diff --git a/src/src/osfunctions.h b/src/src/osfunctions.h
index 552712744..3d1914acb 100644
--- a/src/src/osfunctions.h
+++ b/src/src/osfunctions.h
@@ -32,5 +32,8 @@ extern const char *os_strexit(int); /* char to match os_strsignal */
#ifndef os_strsignal
extern const char *os_strsignal(int); /* char to match strsignal in some OS */
#endif
+#ifndef os_unsetenv
+extern int os_unsetenv(const char *);
+#endif
/* End of osfunctions.h */
diff --git a/src/src/tls.c b/src/src/tls.c
index 0406a10f9..858caa227 100644
--- a/src/src/tls.c
+++ b/src/src/tls.c
@@ -89,7 +89,7 @@ to_tz(uschar * tz)
{
uschar * old = US getenv("TZ");
(void) setenv("TZ", CCS tz, 1);
-tzset();
+tzset();
return old;
}
@@ -99,8 +99,8 @@ restore_tz(uschar * tz)
if (tz)
(void) setenv("TZ", CCS tz, 1);
else
- (void) unsetenv("TZ");
-tzset();
+ (void) os_unsetenv("TZ");
+tzset();
}
/*************************************************