From b0185173147c3eb629cc6b996459cf6ce2d608fe Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 28 Aug 2003 10:51:14 +0000 Subject: * Do not try to remove write permission from symlinks, since chmod() follows symlinks. (Note that the permissions on symlinks are ignored anyway.) --- src/util.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/util.cc') 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)) { -- cgit 1.4.1