diff src/fileio.c @ 696:f0a9ef4db025

updated for version 7.0210
author vimboss
date Tue, 28 Feb 2006 23:52:23 +0000
parents 07d199fe02ed
children 0f9f4761ad9c
line wrap: on
line diff
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -2357,6 +2357,22 @@ failed:
 	curbuf->b_op_start.col = 0;
 	curbuf->b_op_end.lnum = from + linecnt;
 	curbuf->b_op_end.col = 0;
+
+#ifdef WIN32
+	/*
+	 * Work around a weird problem: When a file has two links (only
+	 * possible on NTFS) and we write through one link, then stat() it
+	 * throught the other link, the timestamp information may be wrong.
+	 * It's correct again after reading the file, thus reset the timestamp
+	 * here.
+	 */
+	if (newfile && !read_stdin && !read_buffer
+					 && mch_stat((char *)fname, &st) >= 0)
+	{
+	    buf_store_time(curbuf, &st, fname);
+	    curbuf->b_mtime_read = curbuf->b_mtime;
+	}
+#endif
     }
     msg_scroll = msg_save;
 
@@ -3263,6 +3279,13 @@ buf_write(buf, fname, sfname, start, end
 		    )
 		backup_copy = TRUE;
 	    else
+# else
+#  ifdef WIN32
+	    /* On NTFS file systems hard links are possible. */
+	    if (mch_is_linked(fname))
+		backup_copy = TRUE;
+	    else
+#  endif
 # endif
 	    {
 		/*