From 6aa1e45bd8e877879ff89f3d969531050f51f816 Mon Sep 17 00:00:00 2001 From: Bart Oldeman Date: Thu, 18 Jun 2009 16:42:03 +0000 Subject: [PATCH] Set the clean bit also on created/replaced files, not just opened files, so the directory entry is only updated after they are written too. Fixes SF bug #2380531. git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@1453 6ac86273-5f31-0410-b378-82cca8765d1b --- kernel/fatfs.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/kernel/fatfs.c b/kernel/fatfs.c index 21d599e..c0efeaf 100644 --- a/kernel/fatfs.c +++ b/kernel/fatfs.c @@ -183,10 +183,11 @@ int dos_open(char *path, unsigned flags, unsigned attrib, int fd) fnp->f_offset = 0l; fnp->f_cluster_offset = 0; - fnp->f_flags &= ~(SFT_FDATE|SFT_FCLEAN); - if (status == S_OPENED) - fnp->f_flags |= SFT_FCLEAN; - else + fnp->f_flags &= ~SFT_FDATE; + /* use FCLEAN even on replaced/created files: the bit is reset */ + /* if the file is written to later */ + fnp->f_flags |= SFT_FCLEAN; + if (status != S_OPENED) { init_direntry(&fnp->f_dir, attrib, FREE, fnp->f_dmp->dm_name_pat); if (!dir_write(fnp))