diff options
author | mostynb@opera.com <mostynb@opera.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-09 21:41:02 +0000 |
---|---|---|
committer | mostynb@opera.com <mostynb@opera.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-09 21:41:02 +0000 |
commit | dc5a0c3eaeccf767c97a2ec7ebd641649f5150b7 (patch) | |
tree | ea6abc5c6bbb598135d7f8a8f93d9723814d0ce0 /sandbox | |
parent | 23bafb5af061da6e37ea9302af4f2ec9f6ea65e1 (diff) | |
download | chromium_src-dc5a0c3eaeccf767c97a2ec7ebd641649f5150b7.zip chromium_src-dc5a0c3eaeccf767c97a2ec7ebd641649f5150b7.tar.gz chromium_src-dc5a0c3eaeccf767c97a2ec7ebd641649f5150b7.tar.bz2 |
Ensure that _GNU_SOURCE is defined early enough
This style cleanup broke some versions of glibc that include fcntl.h from
another header before it is explicitly included:
https://codereview.chromium.org/236083002/
We need _GNU_SOURCE defined before the first time fcntl.h is included since
we use the linux-specific O_DIRECTORY extension.
Thanks to johan_e@opera.com for helping track this down.
NOTRY=true
Review URL: https://codereview.chromium.org/266913019
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@269419 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sandbox')
-rw-r--r-- | sandbox/linux/suid/linux_util.c | 7 | ||||
-rw-r--r-- | sandbox/linux/suid/process_util_linux.c | 7 |
2 files changed, 10 insertions, 4 deletions
diff --git a/sandbox/linux/suid/linux_util.c b/sandbox/linux/suid/linux_util.c index 320f6ca..9febe6d9 100644 --- a/sandbox/linux/suid/linux_util.c +++ b/sandbox/linux/suid/linux_util.c @@ -5,9 +5,12 @@ // The following is duplicated from base/linux_utils.cc. // We shouldn't link against C++ code in a setuid binary. -#include "sandbox/linux/suid/linux_util.h" +// Needed for O_DIRECTORY, must be defined before fcntl.h is included +// (and it can be included earlier than the explicit #include below +// in some versions of glibc). +#define _GNU_SOURCE -#define _GNU_SOURCE // For O_DIRECTORY +#include "sandbox/linux/suid/linux_util.h" #include <dirent.h> #include <errno.h> diff --git a/sandbox/linux/suid/process_util_linux.c b/sandbox/linux/suid/process_util_linux.c index d4858c4..2058c3f 100644 --- a/sandbox/linux/suid/process_util_linux.c +++ b/sandbox/linux/suid/process_util_linux.c @@ -5,9 +5,12 @@ // The following is the C version of code from base/process_utils_linux.cc. // We shouldn't link against C++ code in a setuid binary. -#include "sandbox/linux/suid/process_util.h" +// Needed for O_DIRECTORY, must be defined before fcntl.h is included +// (and it can be included earlier than the explicit #include below +// in some versions of glibc). +#define _GNU_SOURCE -#define _GNU_SOURCE // needed for O_DIRECTORY +#include "sandbox/linux/suid/process_util.h" #include <fcntl.h> #include <inttypes.h> |