summaryrefslogtreecommitdiffstats
path: root/third_party/libevent/evutil.c
diff options
context:
space:
mode:
authorevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-20 20:23:54 +0000
committerevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-20 20:23:54 +0000
commit78d4429cef4baac9bcdfc2396ce157016621c416 (patch)
treeca8e34515c63dd682d9b75b9bfc6113fcb0c2dfd /third_party/libevent/evutil.c
parent9101b6b1b3de0a1e3c59325055707c58748651af (diff)
downloadchromium_src-78d4429cef4baac9bcdfc2396ce157016621c416.zip
chromium_src-78d4429cef4baac9bcdfc2396ce157016621c416.tar.gz
chromium_src-78d4429cef4baac9bcdfc2396ce157016621c416.tar.bz2
posix: upgrade libevent from 1.4.7 to 1.4.13
I took this opportunity to rejigger how we hacked around using an uninstalled libevent, to remove a TODO that mentioned danger in the README. Files to review: README.chromium and chromium.patch. The rest are probably rubber-stampable. Review URL: http://codereview.chromium.org/412006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@32656 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'third_party/libevent/evutil.c')
-rw-r--r--third_party/libevent/evutil.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/third_party/libevent/evutil.c b/third_party/libevent/evutil.c
index 311b962..564377d 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);
+}