Index: third_party/libevent/evutil.c |
diff --git a/third_party/libevent/evutil.c b/third_party/libevent/evutil.c |
index 311b96296ad47b9e7cbc0337556ce8794c56bbbf..564377d70c173c8b1bc19cd22740c515a6843aef 100644 |
--- a/third_party/libevent/evutil.c |
+++ b/third_party/libevent/evutil.c |
@@ -53,7 +53,11 @@ |
#include <sys/timeb.h> |
#endif |
#include <stdio.h> |
+#include <signal.h> |
+#include <sys/queue.h> |
+#include "event.h" |
+#include "event-internal.h" |
#include "evutil.h" |
#include "log.h" |
@@ -243,3 +247,31 @@ evutil_vsnprintf(char *buf, size_t buflen, const char *format, va_list ap) |
return r; |
#endif |
} |
+ |
+static int |
+evutil_issetugid(void) |
+{ |
+#ifdef _EVENT_HAVE_ISSETUGID |
+ return issetugid(); |
+#else |
+ |
+#ifdef _EVENT_HAVE_GETEUID |
+ if (getuid() != geteuid()) |
+ return 1; |
+#endif |
+#ifdef _EVENT_HAVE_GETEGID |
+ if (getgid() != getegid()) |
+ return 1; |
+#endif |
+ return 0; |
+#endif |
+} |
+ |
+const char * |
+evutil_getenv(const char *varname) |
+{ |
+ if (evutil_issetugid()) |
+ return NULL; |
+ |
+ return getenv(varname); |
+} |