From ddf2ad1612c1833d89457b43c9f94305cee86f2c Mon Sep 17 00:00:00 2001 From: Pavel Roskin Date: Wed, 25 Dec 2002 04:57:26 +0000 Subject: [PATCH] * direntry.c (vfs_s_open): If the filesystem is read-only, disable file creation. --- vfs/ChangeLog | 3 +++ vfs/direntry.c | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/vfs/ChangeLog b/vfs/ChangeLog index bd8e9baf3..635f4d88d 100644 --- a/vfs/ChangeLog +++ b/vfs/ChangeLog @@ -1,5 +1,8 @@ 2002-12-24 Pavel Roskin + * direntry.c (vfs_s_open): If the filesystem is read-only, + disable file creation. + * vfs.c (mc_chdir): Don't change current directory until the low-level chdir succeeds. diff --git a/vfs/direntry.c b/vfs/direntry.c index 127b2b213..d9d68faf7 100644 --- a/vfs/direntry.c +++ b/vfs/direntry.c @@ -753,7 +753,9 @@ vfs_s_open (vfs *me, char *file, int flags, int mode) vfs_s_entry *ent; vfs_s_inode *dir; int tmp_handle; - if (!(flags & O_CREAT)) + + /* If the filesystem is read-only, disable file creation */ + if (!(flags & O_CREAT) || !(me->write)) return NULL; split_dir_name (me, q, &dirname, &name, &save);