[Libsysio-commit] HEAD: libsysio/src access.c
Brought to you by:
lward
From: Lee W. <lw...@us...> - 2004-07-31 14:28:59
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30301 Modified Files: access.c Log Message: From Cray SPR 729654: access(path, -1) sets errno 13 instead of 22. We weren't checking to see if the passed mode was restricted only to the supported mask combinations. Fixed now. Fixed another as well. We didn't support F_OK. Do now. Index: access.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/access.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -w -b -B -p -r1.8 -r1.9 --- access.c 27 Jul 2004 15:00:43 -0000 1.8 +++ access.c 31 Jul 2004 14:28:51 -0000 1.9 @@ -64,6 +64,12 @@ SYSIO_INTERFACE_NAME(access)(const char SYSIO_INTERFACE_ENTER; err = 0; + /* + * Check amode. + */ + if ((amode & (R_OK|W_OK|X_OK)) != amode) + SYSIO_INTERFACE_RETURN(-1, -EINVAL); + n = getgroups(0, NULL); list = NULL; if (n) { @@ -82,6 +88,9 @@ SYSIO_INTERFACE_NAME(access)(const char err = -errno; goto out; } + if (!amode) + SYSIO_INTERFACE_RETURN(0, 0); + mask = 0; if (amode & R_OK) |