--- replace.old 2001-03-25 11:08:20 +0000 +++ replace.c 2013-10-12 18:43:46 +0000 @@ -526,6 +526,24 @@ buffersize = fread(buffer, sizeof(char), BUFSIZ, src_file); } +#ifdef BUGFIX + /* + DJGPP's "info libc a setftime" says this: + + since writing to a file and closing a file + opened for writing also sets the modification + time, you should only use this function on files + opened for reading. + */ + + /* close files */ + fclose(src_file); + fclose(dest_file); + + src_file = fopen(src_filename, "rb"); + dest_file = fopen(dest_filename, "rb"); +#endif + /* copy file timestamp */ getftime(fileno(src_file), &filetime); setftime(fileno(dest_file), &filetime);