Time to import OpenBSD once again. Expect breakage.
This commit is contained in:
16
c_test.c
16
c_test.c
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: c_test.c,v 1.9 2003/02/28 09:45:09 jmc Exp $ */
|
||||
/* $OpenBSD: c_test.c,v 1.10 2003/10/10 19:09:07 millert Exp $ */
|
||||
|
||||
/*
|
||||
* test(1); version 7-like -- author Erik Baalbergen
|
||||
@ -458,10 +458,12 @@ test_eaccess(path, mode)
|
||||
}
|
||||
#endif /* !HAVE_DEV_FD */
|
||||
|
||||
/* On most (all?) unixes, access() says everything is executable for
|
||||
res = eaccess(path, mode);
|
||||
/*
|
||||
* On most (all?) unixes, access() says everything is executable for
|
||||
* root - avoid this on files by using stat().
|
||||
*/
|
||||
if ((mode & X_OK) && ksheuid == 0) {
|
||||
if (res == 0 && ksheuid == 0 && (mode & X_OK)) {
|
||||
struct stat statb;
|
||||
|
||||
if (stat(path, &statb) < 0)
|
||||
@ -471,13 +473,7 @@ test_eaccess(path, mode)
|
||||
else
|
||||
res = (statb.st_mode & (S_IXUSR|S_IXGRP|S_IXOTH))
|
||||
? 0 : -1;
|
||||
/* Need to check other permissions? If so, use access() as
|
||||
* this will deal with root on NFS.
|
||||
*/
|
||||
if (res == 0 && (mode & (R_OK|W_OK)))
|
||||
res = eaccess(path, mode);
|
||||
} else
|
||||
res = eaccess(path, mode);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
Reference in New Issue
Block a user