about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/libstore/normalise.cc15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/libstore/normalise.cc b/src/libstore/normalise.cc
index fbbaf9e07804..9d51a4cd62a4 100644
--- a/src/libstore/normalise.cc
+++ b/src/libstore/normalise.cc
@@ -334,14 +334,15 @@ void canonicalisePathMetaData(const Path & path)
                 throw SysError(format("changing owner/group of `%1%' to %2%/%3%")
                     % path % getuid() % getgid());
         }
-    }
 
-    if (st.st_mtime != 0) {
-        struct utimbuf utimbuf;
-        utimbuf.actime = st.st_atime;
-        utimbuf.modtime = 0;
-        if (utime(path.c_str(), &utimbuf) == -1) 
-            throw SysError(format("changing modification time of `%1%'") % path);
+        if (st.st_mtime != 0) {
+            struct utimbuf utimbuf;
+            utimbuf.actime = st.st_atime;
+            utimbuf.modtime = 0;
+            if (utime(path.c_str(), &utimbuf) == -1) 
+                throw SysError(format("changing modification time of `%1%'") % path);
+        }
+
     }
 
     if (S_ISDIR(st.st_mode)) {