From 8856cce94ac4d2104c2592ef26afe62c52814af6 Mon Sep 17 00:00:00 2001 From: rswindell <> Date: Sun, 29 Oct 2017 22:57:30 +0000 Subject: [PATCH] When backup() used with the copy option (ren = false), set the copied file time stamp (modification time) to the original file's time stamp, since we're not modifying the contents when making the copy. --- src/sbbs3/scfgsave.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/sbbs3/scfgsave.c b/src/sbbs3/scfgsave.c index 7f48181fb3..eee8f042a1 100644 --- a/src/sbbs3/scfgsave.c +++ b/src/sbbs3/scfgsave.c @@ -162,9 +162,18 @@ BOOL DLLCALL backup(char *fname, int backup_level, BOOL ren) if(ren == TRUE) { if(rename(fname,newname)!=0) return(FALSE); - } else + } else { + struct utimbuf ut; + + /* preserve the original time stamp */ + ut.modtime = fdate(fname); + if(!fcopy(fname,newname)) return(FALSE); + + ut.actime = time(NULL); + utime(newname, &ut); + } continue; } safe_snprintf(oldname,sizeof(oldname),"%.*s.%d%s",len,fname,i-2,ext); -- GitLab