diff options
author | Igor Pashev <pashev.igor@gmail.com> | 2013-02-16 14:42:43 +0000 |
---|---|---|
committer | Igor Pashev <pashev.igor@gmail.com> | 2013-02-16 14:42:43 +0000 |
commit | 974ab3dd887985e3aa347f3c6521f819296396a0 (patch) | |
tree | 802fb82c9f8ec8acd7a60fba7824c2df6f0073ad /lib/euidaccess.c | |
parent | 8e7ba70eba02f88d4f3ba12e07ab9c7bdf32240a (diff) | |
download | coreutils-974ab3dd887985e3aa347f3c6521f819296396a0.tar.gz |
Imported Upstream version 8.21upstream/8.21
Diffstat (limited to 'lib/euidaccess.c')
-rw-r--r-- | lib/euidaccess.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/euidaccess.c b/lib/euidaccess.c index 44e0ea11..f73438e6 100644 --- a/lib/euidaccess.c +++ b/lib/euidaccess.c @@ -1,6 +1,6 @@ /* euidaccess -- check if effective user id can access file - Copyright (C) 1990-1991, 1995, 1998, 2000, 2003-2006, 2008-2012 Free + Copyright (C) 1990-1991, 1995, 1998, 2000, 2003-2006, 2008-2013 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -30,6 +30,8 @@ #include <sys/stat.h> #include <unistd.h> +#include "root-uid.h" + #if HAVE_LIBGEN_H # include <libgen.h> #endif @@ -82,7 +84,7 @@ euidaccess (const char *file, int mode) return accessx (file, mode, ACC_SELF); #elif HAVE_EACCESS /* FreeBSD */ return eaccess (file, mode); -#else /* MacOS X, NetBSD, OpenBSD, HP-UX, Solaris, Cygwin, mingw, BeOS */ +#else /* Mac OS X, NetBSD, OpenBSD, HP-UX, Solaris, Cygwin, mingw, BeOS */ uid_t uid = getuid (); gid_t gid = getgid (); @@ -140,8 +142,9 @@ euidaccess (const char *file, int mode) /* The super-user can read and write any file, and execute any file that anyone can execute. */ - if (euid == 0 && ((mode & X_OK) == 0 - || (stats.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))) + if (euid == ROOT_UID + && ((mode & X_OK) == 0 + || (stats.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))) return 0; /* Convert the mode to traditional form, clearing any bogus bits. */ |