emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r108850: Fix bugs in file timestamp n


From: Paul Eggert
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r108850: Fix bugs in file timestamp newness comparisons.
Date: Tue, 03 Jul 2012 17:04:46 -0700
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 108850
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Tue 2012-07-03 17:04:46 -0700
message:
  Fix bugs in file timestamp newness comparisons.
  
  * fileio.c (Ffile_newer_than_file_p):
  * lread.c (Fload): Use full timestamp resolution of files,
  not just the 1-second resolution, so that files that are only
  slightly newer still count as newer.
  * fileio.c (Ffile_newer_than_file_p): Don't assume file
  timestamps fit in 'int'; this fixes a Y2038 bug on most hosts.
modified:
  src/ChangeLog
  src/fileio.c
  src/lread.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2012-07-03 23:51:32 +0000
+++ b/src/ChangeLog     2012-07-04 00:04:46 +0000
@@ -1,5 +1,16 @@
+2012-07-04  Paul Eggert  <address@hidden>
+
+       Fix bugs in file timestamp newness comparisons.
+       * fileio.c (Ffile_newer_than_file_p):
+       * lread.c (Fload): Use full timestamp resolution of files,
+       not just the 1-second resolution, so that files that are only
+       slightly newer still count as newer.
+       * fileio.c (Ffile_newer_than_file_p): Don't assume file
+       timestamps fit in 'int'; this fixes a Y2038 bug on most hosts.
+
 2012-07-03  Paul Eggert  <address@hidden>
 
+
        * fileio.c: Improve handling of file time marker.  (Bug#11852)
        (special_mtime): New function.
        (Finsert_file_contents, Fverify_visited_file_modtime):

=== modified file 'src/fileio.c'
--- a/src/fileio.c      2012-07-03 23:51:32 +0000
+++ b/src/fileio.c      2012-07-04 00:04:46 +0000
@@ -3079,8 +3079,7 @@
   (Lisp_Object file1, Lisp_Object file2)
 {
   Lisp_Object absname1, absname2;
-  struct stat st;
-  int mtime1;
+  struct stat st1, st2;
   Lisp_Object handler;
   struct gcpro gcpro1, gcpro2;
 
@@ -3106,15 +3105,14 @@
   absname2 = ENCODE_FILE (absname2);
   UNGCPRO;
 
-  if (stat (SSDATA (absname1), &st) < 0)
+  if (stat (SSDATA (absname1), &st1) < 0)
     return Qnil;
 
-  mtime1 = st.st_mtime;
-
-  if (stat (SSDATA (absname2), &st) < 0)
+  if (stat (SSDATA (absname2), &st2) < 0)
     return Qt;
 
-  return (mtime1 > st.st_mtime) ? Qt : Qnil;
+  return (EMACS_TIME_GT (get_stat_mtime (&st1), get_stat_mtime (&st2))
+         ? Qt : Qnil);
 }
 
 #ifndef READ_BUF_SIZE

=== modified file 'src/lread.c'
--- a/src/lread.c       2012-06-30 21:10:50 +0000
+++ b/src/lread.c       2012-07-04 00:04:46 +0000
@@ -26,6 +26,7 @@
 #include <errno.h>
 #include <limits.h>    /* For CHAR_BIT.  */
 #include <setjmp.h>
+#include <stat-time.h>
 #include "lisp.h"
 #include "intervals.h"
 #include "character.h"
@@ -1214,7 +1215,8 @@
              SSET (efound, SBYTES (efound) - 1, 'c');
            }
 
-         if (result == 0 && s1.st_mtime < s2.st_mtime)
+         if (result == 0
+             && EMACS_TIME_LT (get_stat_mtime (&s1), get_stat_mtime (&s2)))
            {
              /* Make the progress messages mention that source is newer.  */
              newer = 1;


reply via email to

[Prev in Thread] Current Thread [Next in Thread]