* Do not try to remove write permission from symlinks, since chmod()
follows symlinks. (Note that the permissions on symlinks are ignored anyway.)
This commit is contained in:
parent
c4f1f49574
commit
b018517314
2 changed files with 3 additions and 3 deletions
|
@ -149,9 +149,9 @@ void makePathReadOnly(const string & path)
|
||||||
if (lstat(path.c_str(), &st))
|
if (lstat(path.c_str(), &st))
|
||||||
throw SysError(format("getting attributes of path `%1%'") % path);
|
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)
|
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)) {
|
if (S_ISDIR(st.st_mode)) {
|
||||||
|
|
Loading…
Reference in a new issue