about summary refs log tree commit diff
path: root/src/libstore
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2004-11-29T19·22+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2004-11-29T19·22+0000
commit13f77276d11610171bc7774406b65b6cb73d453a (patch)
treef12f7aa04fae9e52b7359685f5fd6c36428c213f /src/libstore
parenteee6fe478e5a0275b2da382216a5b8ec24e04290 (diff)
* utime() follows symlinks, so don't change the mtime if the file is a
  symlink.

Diffstat (limited to 'src/libstore')
-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)) {