Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Unified Diff: third_party/libevent/evutil.c

Issue 412006: posix: upgrade libevent from 1.4.7 to 1.4.13 (Closed)
Patch Set: better readme Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);
+}

Powered by Google App Engine
This is Rietveld 408576698