summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2018-03-21 08:15:15 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2018-03-21 08:15:15 +0000
commit50e3e3e72f97c32cf868efb580ffed4772e61b2d (patch)
tree3bcacfd628f37d0f170042ef4eafb16dbe642f2a
parentc8a706117fc45e8586b2c9f06b527b50da2d3bdb (diff)
Remove EVENT_* variables from environment after initializing libevent so they
are not carried into child processes; from Henry Qin.
-rw-r--r--osdep-darwin.c8
-rw-r--r--osdep-freebsd.c7
-rw-r--r--osdep-linux.c7
3 files changed, 19 insertions, 3 deletions
diff --git a/osdep-darwin.c b/osdep-darwin.c
index 9956ab45..5d69cdda 100644
--- a/osdep-darwin.c
+++ b/osdep-darwin.c
@@ -88,11 +88,17 @@ osdep_get_cwd(int fd)
struct event_base *
osdep_event_init(void)
{
+ struct event_base *base;
+
/*
* On OS X, kqueue and poll are both completely broken and don't
* work on anything except socket file descriptors (yes, really).
*/
setenv("EVENT_NOKQUEUE", "1", 1);
setenv("EVENT_NOPOLL", "1", 1);
- return (event_init());
+
+ base = event_init();
+ unsetenv("EVENT_NOKQUEUE");
+ unsetenv("EVENT_NOPOLL");
+ return (base);
}
diff --git a/osdep-freebsd.c b/osdep-freebsd.c
index 067ba565..61f3f507 100644
--- a/osdep-freebsd.c
+++ b/osdep-freebsd.c
@@ -193,10 +193,15 @@ osdep_get_cwd(int fd)
struct event_base *
osdep_event_init(void)
{
+ struct event_base *base;
+
/*
* On some versions of FreeBSD, kqueue doesn't work properly on tty
* file descriptors. This is fixed in recent FreeBSD versions.
*/
setenv("EVENT_NOKQUEUE", "1", 1);
- return (event_init());
+
+ base = event_init();
+ unsetenv("EVENT_NOKQUEUE");
+ return (base);
}
diff --git a/osdep-linux.c b/osdep-linux.c
index 42712dea..5f0d9352 100644
--- a/osdep-linux.c
+++ b/osdep-linux.c
@@ -92,7 +92,12 @@ osdep_get_cwd(int fd)
struct event_base *
osdep_event_init(void)
{
+ struct event_base *base;
+
/* On Linux, epoll doesn't work on /dev/null (yes, really). */
setenv("EVENT_NOEPOLL", "1", 1);
- return (event_init());
+
+ base = event_init();
+ unsetenv("EVENT_NOEPOLL");
+ return (base);
}