mirror of https://github.com/FDOS/kernel.git
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:
parent
46b58be248
commit
0f4d6ea6a1
|
@ -50,6 +50,7 @@ static BYTE *file_hRcsId =
|
||||||
#define O_RDONLY SFT_MREAD
|
#define O_RDONLY SFT_MREAD
|
||||||
#define O_WRONLY SFT_MWRITE
|
#define O_WRONLY SFT_MWRITE
|
||||||
#define O_RDWR SFT_MRDWR
|
#define O_RDWR SFT_MRDWR
|
||||||
|
#define O_ACCMODE 3
|
||||||
|
|
||||||
/* bits 2, 3 reserved */
|
/* bits 2, 3 reserved */
|
||||||
/* bits 4, 5, 6 sharing modes */
|
/* bits 4, 5, 6 sharing modes */
|
||||||
|
|
|
@ -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 */
|
/* First test the flags to see if the user has passed a valid */
|
||||||
/* file mode... */
|
/* file mode... */
|
||||||
if ((flags & 3) > 2)
|
if ((flags & O_ACCMODE) > 2)
|
||||||
return DE_INVLDACC;
|
return DE_INVLDACC;
|
||||||
|
|
||||||
/* first split the passed dir into comopnents (i.e. - path to */
|
/* 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;
|
flags = (flags & ~3) | O_RDONLY;
|
||||||
|
|
||||||
/* Check permissions. -- JPP */
|
/* 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);
|
dir_close(fnp);
|
||||||
return DE_ACCESS;
|
return DE_ACCESS;
|
||||||
|
@ -219,8 +220,8 @@ long dos_open(char *path, unsigned flags, unsigned attrib)
|
||||||
|
|
||||||
/* Set the fnode to the desired mode */
|
/* Set the fnode to the desired mode */
|
||||||
/* Updating the directory entry first. */
|
/* Updating the directory entry first. */
|
||||||
fnp->f_mode = flags & 3;
|
fnp->f_mode = flags & O_ACCMODE;
|
||||||
|
|
||||||
if (status != S_OPENED)
|
if (status != S_OPENED)
|
||||||
{
|
{
|
||||||
init_direntry(&fnp->f_dir, attrib, FREE);
|
init_direntry(&fnp->f_dir, attrib, FREE);
|
||||||
|
|
Loading…
Reference in New Issue