Do not attempt to chmod per-user dir when read-only.

This commit is contained in:
Ben Radford 2023-05-16 13:29:16 +01:00
parent de359da09a
commit 79583c2d38
No known key found for this signature in database
GPG key ID: 9DF5D4640AB888D5

View file

@ -204,8 +204,10 @@ LocalStore::LocalStore(const Params & params)
for (auto & perUserDir : {profilesDir + "/per-user", gcRootsDir + "/per-user"}) {
createDirs(perUserDir);
if (chmod(perUserDir.c_str(), 0755) == -1)
throw SysError("could not set permissions on '%s' to 755", perUserDir);
if (!readOnly) {
if (chmod(perUserDir.c_str(), 0755) == -1)
throw SysError("could not set permissions on '%s' to 755", perUserDir);
}
}
/* Optionally, create directories and set permissions for a