From 13f77276d11610171bc7774406b65b6cb73d453a Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 29 Nov 2004 19:22:16 +0000 Subject: * utime() follows symlinks, so don't change the mtime if the file is a symlink. --- src/libstore/normalise.cc | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/libstore/normalise.cc') 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)) { -- cgit 1.4.1