From 3232712faeeb7da08e32bb187e9247c7a9b82cfb Mon Sep 17 00:00:00 2001 From: Bart Oldeman Date: Sun, 16 Nov 2003 16:21:29 +0000 Subject: [PATCH] force r/o open for FCB and legacy creat if the file is read-only git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@726 6ac86273-5f31-0410-b378-82cca8765d1b --- kernel/fatfs.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/kernel/fatfs.c b/kernel/fatfs.c index 676ec32..dfaefd5 100644 --- a/kernel/fatfs.c +++ b/kernel/fatfs.c @@ -216,8 +216,10 @@ long dos_open(char *path, unsigned flags, unsigned attrib) } } - /* force r/o open for FCBs if the file is read-only */ - if ((flags & O_FCB) && (fnp->f_dir.dir_attrib & D_RDONLY)) + /* force r/o open for FCB and legacy creat if the file is read-only */ + if (((flags & O_FCB) + || (flags & (O_CREAT | O_LEGACY)) == (O_CREAT | O_LEGACY)) + && (fnp->f_dir.dir_attrib & D_RDONLY)) fnp->f_mode = O_RDONLY; /* Check permissions. -- JPP */