Define O_ACCMODE and use it instead of "3" for the open access mask.

git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@828 6ac86273-5f31-0410-b378-82cca8765d1b
This commit is contained in:
Bart Oldeman 2004-03-26 23:20:55 +00:00
parent 46b58be248
commit 0f4d6ea6a1
2 changed files with 6 additions and 4 deletions

View File

@ -50,6 +50,7 @@ static BYTE *file_hRcsId =
#define O_RDONLY SFT_MREAD
#define O_WRONLY SFT_MWRITE
#define O_RDWR SFT_MRDWR
#define O_ACCMODE 3
/* bits 2, 3 reserved */
/* bits 4, 5, 6 sharing modes */

View File

@ -150,7 +150,7 @@ long dos_open(char *path, unsigned flags, unsigned attrib)
/* First test the flags to see if the user has passed a valid */
/* file mode... */
if ((flags & 3) > 2)
if ((flags & O_ACCMODE) > 2)
return DE_INVLDACC;
/* first split the passed dir into comopnents (i.e. - path to */
@ -187,7 +187,8 @@ long dos_open(char *path, unsigned flags, unsigned attrib)
flags = (flags & ~3) | O_RDONLY;
/* Check permissions. -- JPP */
if ((fnp->f_dir.dir_attrib & D_RDONLY) && ((flags & 3) != O_RDONLY))
if ((fnp->f_dir.dir_attrib & D_RDONLY) &&
((flags & O_ACCMODE) != O_RDONLY))
{
dir_close(fnp);
return DE_ACCESS;
@ -219,8 +220,8 @@ long dos_open(char *path, unsigned flags, unsigned attrib)
/* Set the fnode to the desired mode */
/* Updating the directory entry first. */
fnp->f_mode = flags & 3;
fnp->f_mode = flags & O_ACCMODE;
if (status != S_OPENED)
{
init_direntry(&fnp->f_dir, attrib, FREE);