about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2003-08-28T10·51+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2003-08-28T10·51+0000
commitb0185173147c3eb629cc6b996459cf6ce2d608fe (patch)
tree20f7063a06454f0f7ebf9e77add9010932412458
parentc4f1f49574b4fe55bef7952bd0fcc2bd626b0db2 (diff)
* Do not try to remove write permission from symlinks, since chmod()
  follows symlinks.  (Note that the permissions on symlinks are
  ignored anyway.)

-rw-r--r--src/normalise.cc2
-rw-r--r--src/util.cc4
2 files changed, 3 insertions, 3 deletions
diff --git a/src/normalise.cc b/src/normalise.cc
index c7be5320611e..39867bfe5738 100644
--- a/src/normalise.cc
+++ b/src/normalise.cc
@@ -202,7 +202,7 @@ FSId normaliseFState(FSId id, FSIdSet pending)
 	/* For this output path, find the references to other paths contained
 	   in it. */
         Strings refPaths = filterReferences(path, 
-					    Strings(allPaths.begin(), allPaths.end()));
+            Strings(allPaths.begin(), allPaths.end()));
 
 	/* Construct a slice element for this output path. */
         SliceElem elem;
diff --git a/src/util.cc b/src/util.cc
index c7ae711bbac7..f2cdb1d72345 100644
--- a/src/util.cc
+++ b/src/util.cc
@@ -149,9 +149,9 @@ void makePathReadOnly(const string & path)
     if (lstat(path.c_str(), &st))
 	throw SysError(format("getting attributes of path `%1%'") % path);
 
-    if (st.st_mode & S_IWUSR) {
+    if (!S_ISLNK(st.st_mode) && (st.st_mode & S_IWUSR)) {
 	if (chmod(path.c_str(), st.st_mode & ~S_IWUSR) == -1)
-	    throw SysError(format("making `%1%' read-only"));
+	    throw SysError(format("making `%1%' read-only") % path);
     }
 
     if (S_ISDIR(st.st_mode)) {