[Libsysio-commit] HEAD: libsysio/include file.h
Brought to you by:
lward
From: Lee W. <lw...@us...> - 2007-04-12 18:00:49
|
Update of /cvsroot/libsysio/libsysio/include In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv25748/include Modified Files: file.h Log Message: F_CHKRW macro in file.h was improperly implemented. Not according to comment. From Bob Glossman at Cray. Reimplemented and new implementation used in truncate.c Index: file.h =================================================================== RCS file: /cvsroot/libsysio/libsysio/include/file.h,v retrieving revision 1.16 retrieving revision 1.17 diff -u -w -b -B -p -r1.16 -r1.17 --- file.h 3 May 2006 22:34:46 -0000 1.16 +++ file.h 12 Apr 2007 18:00:42 -0000 1.17 @@ -115,15 +115,17 @@ struct file { /* * Determine if a file may be read/written. * - * Given a ptr to an open file table entry and a flag indicating read or - * write return 0 if the file record indicates that the access is permitted - * or -EBADF, if not. + * Given a ptr to an open file table entry and a flag indicating desired + * access return non-zero if the file record indicates that the access is + * permitted or zero, if not. + * + * 'r' for read access check + * 'w' for write access check */ #define F_CHKRW(_fil, _c) \ - (((_c) == O_RDONLY && \ - ((_fil)->f_flags & O_RDONLY || (_fil)->f_flags & O_RDWR)) || \ - ((_fil)->f_flags & O_WRONLY || (_fil)->f_flags & O_RDWR)) + (((_c) == 'r' && !((_fil)->f_flags & O_WRONLY)) || \ + ((_c) == 'w' && ((_fil)->f_flags & (O_WRONLY | O_RDWR)))) struct ioctx; |