#include "config.h" #include "util.hh" #include "local-store.hh" #include "globals.hh" #include #include #include #include #include #include #include namespace nix { /* Any file smaller than this is not considered for deduplication. Keep in sync with (guix store deduplication). */ const size_t deduplicationMinSize = 8192; static void makeWritable(const Path & path) { struct stat st; if (lstat(path.c_str(), &st)) throw SysError(format("getting attributes of path `%1%'") % path); if (chmod(path.c_str(), st.st_mode | S_IWUSR) == -1) throw SysError(format("changing writability of `%1%'") % path); } struct MakeReadOnly { Path path; MakeReadOnly(const Path & path) : path(path) { } ~MakeReadOnly() { try { /* This will make the path read-only. */ if (path != "") canonicaliseTimestampAndPermissions(path); } catch (...) { ignoreException();
aboutsummaryrefslogtreecommitdiff