-
-/* Return 0 if the user has permission of type MODE on file PATH;
- otherwise, return -1 and set `errno' to EACCESS.
- Like access, except that it uses the effective user and group
- id's instead of the real ones, and it does not check for read-only
- filesystem, text busy, etc. */
-
-int
-euidaccess (path, mode)
- char *path;
- int mode;
-{
- struct stat stats;
-
- if (have_ids == 0)
- {
- have_ids = 1;
- uid = getuid ();
- gid = getgid ();
- euid = geteuid ();
- egid = getegid ();
- }
-
- if (uid == euid && gid == egid)
- {
- return access (path, mode);
- }
-
- if (SAFE_STAT (path, &stats))
- return -1;
-
- return eaccess_stat (&stats, mode, path);
-}
-