From dfed3ac186e2ebf959ffdccf8b02816b6d1219de Mon Sep 17 00:00:00 2001 From: janwas Date: Thu, 27 Apr 2006 03:11:45 +0000 Subject: [PATCH] # bugfix: was triggering write-to-mod feature for all file writes due to incorrect flag comparison (2 bits must both be set) This was SVN commit r3824. --- source/lib/res/file/vfs.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source/lib/res/file/vfs.cpp b/source/lib/res/file/vfs.cpp index 93d11ada0a..e2fa5096f3 100644 --- a/source/lib/res/file/vfs.cpp +++ b/source/lib/res/file/vfs.cpp @@ -289,7 +289,11 @@ static LibError VFile_reload(VFile* vf, const char* V_path, Handle) return err; } - if(flags & FILE_WRITE_TO_MOD) + // careful! FILE_WRITE_TO_MOD consists of 2 bits; they must both be + // set (one of them is FILE_WRITE, which can be set independently). + // this is a bit ugly but better than requiring users to write + // FILE_WRITE|FILE_WRITE_TO_MOD. + if((flags & FILE_WRITE_TO_MOD) == FILE_WRITE_TO_MOD) RETURN_ERR(set_mount_to_mod_target(tf)); RETURN_ERR(xfile_open(V_path, flags, tf, &vf->f));