about summary refs log tree commit diff
path: root/src/libstore/local-store.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2012-02-15T00·00+0100
committerEelco Dolstra <e.dolstra@tudelft.nl>2012-02-15T00·00+0100
commit5e57047d874e0f01dcb3bbc8b809fcc1aa82755b (patch)
treedef90578ebbf0dd413e022a362e11ff31eb6bf18 /src/libstore/local-store.cc
parent58ac7a17a43587001331e4a0379d38c369b99057 (diff)
Fix a broken guard around utime()
Because of an outdated check for a timestamp of 0, we were calling
utime() even when it wasn't necessary.
Diffstat (limited to 'src/libstore/local-store.cc')
-rw-r--r--src/libstore/local-store.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc
index 771776f6a2c7..a30839643c4b 100644
--- a/src/libstore/local-store.cc
+++ b/src/libstore/local-store.cc
@@ -394,6 +394,9 @@ void LocalStore::openDB(bool create)
 }
 
 
+const time_t mtimeStore = 1; /* 1 second into the epoch */
+
+
 void canonicalisePathMetaData(const Path & path, bool recurse)
 {
     checkInterrupt();
@@ -433,10 +436,10 @@ void canonicalisePathMetaData(const Path & path, bool recurse)
                 throw SysError(format("changing mode of `%1%' to %2$o") % path % mode);
         }
 
-        if (st.st_mtime != 0) {
+        if (st.st_mtime != mtimeStore) {
             struct utimbuf utimbuf;
             utimbuf.actime = st.st_atime;
-            utimbuf.modtime = 1; /* 1 second into the epoch */
+            utimbuf.modtime = mtimeStore;
             if (utime(path.c_str(), &utimbuf) == -1) 
                 throw SysError(format("changing modification time of `%1%'") % path);
         }