* fileio.c (Finsert_file_contents): Properly handle st_mtime
authorAndreas Schwab <schwab@linux-m68k.org>
Tue, 3 Jul 2012 22:03:37 +0000 (00:03 +0200)
committerAndreas Schwab <schwab@linux-m68k.org>
Tue, 3 Jul 2012 22:03:37 +0000 (00:03 +0200)
marker for non-existing file.

src/ChangeLog
src/fileio.c

index b1575f6..a82d2a0 100644 (file)
@@ -1,3 +1,8 @@
+2012-07-03  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * fileio.c (Finsert_file_contents): Properly handle st_mtime
+       marker for non-existing file.  (Bug#11852)
+
 2012-07-03  Glenn Morris  <rgm@gnu.org>
 
        * lisp.h (Fread_file_name): Restore EXFUN (it's not a normal DEFUN
index 9429570..820dabf 100644 (file)
@@ -4193,7 +4193,10 @@ variable `last-coding-system-used' to the coding system actually used.  */)
 
       if (NILP (handler))
        {
-         current_buffer->modtime = get_stat_mtime (&st);
+         if (st.st_mtime == -1)
+           EMACS_SET_INVALID_TIME (current_buffer->modtime);
+         else
+           current_buffer->modtime = get_stat_mtime (&st);
          current_buffer->modtime_size = st.st_size;
          BVAR (current_buffer, filename) = orig_filename;
        }