X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Feuidaccess.c;h=363e6fe2d70f0311744296d372e483c44d952f61;hb=7ef6c64e210ac0979d7e8ac69bc5b5208c2405ab;hp=44e0ea1127515625605497cf61d9765b79bf0f3e;hpb=51e801f2f297e45a24004ee6256dd1a6c7389074;p=gnulib.git diff --git a/lib/euidaccess.c b/lib/euidaccess.c index 44e0ea112..363e6fe2d 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-2014 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -30,6 +30,8 @@ #include #include +#include "root-uid.h" + #if HAVE_LIBGEN_H # include #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. */