aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/optimise-store.cc
diff options
context:
space:
mode:
authorBen Burdette <bburdette@gmail.com>2020-05-01 14:32:06 -0600
committerBen Burdette <bburdette@gmail.com>2020-05-01 14:32:06 -0600
commit4b99c09f5ccd385d2bf0c82a8c9a4ae1658abbe8 (patch)
tree44b6f9543e794ecaf3fd5b491c53dbbe9e0a4e58 /src/libstore/optimise-store.cc
parenta3030e3c3186f980716c475155c387bf18041a3f (diff)
convert some errors
Diffstat (limited to 'src/libstore/optimise-store.cc')
-rw-r--r--src/libstore/optimise-store.cc18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/libstore/optimise-store.cc b/src/libstore/optimise-store.cc
index f9cf2bb6b..9f6112183 100644
--- a/src/libstore/optimise-store.cc
+++ b/src/libstore/optimise-store.cc
@@ -130,7 +130,11 @@ void LocalStore::optimisePath_(Activity * act, OptimiseStats & stats,
NixOS (example: $fontconfig/var/cache being modified). Skip
those files. FIXME: check the modification time. */
if (S_ISREG(st.st_mode) && (st.st_mode & S_IWUSR)) {
- printError("skipping suspicious writable file '%1%'", path);
+ logWarning(
+ ErrorInfo {
+ .name = "Suspicious File",
+ .hint = hintfmt("skipping suspicious writable file '%1%'", path)
+ });
return;
}
@@ -194,7 +198,11 @@ void LocalStore::optimisePath_(Activity * act, OptimiseStats & stats,
}
if (st.st_size != stLink.st_size) {
- printError("removing corrupted link '%1%'", linkPath);
+ logWarning(
+ ErrorInfo {
+ .name = "Corrupted Link",
+ .hint = hintfmt("removing corrupted link '%1%'", linkPath)
+ });
unlink(linkPath.c_str());
goto retry;
}
@@ -229,7 +237,11 @@ void LocalStore::optimisePath_(Activity * act, OptimiseStats & stats,
/* Atomically replace the old file with the new hard link. */
if (rename(tempLink.c_str(), path.c_str()) == -1) {
if (unlink(tempLink.c_str()) == -1)
- printError("unable to unlink '%1%'", tempLink);
+ logError(
+ ErrorInfo {
+ .name = "Unlink error",
+ .hint = hintfmt("unable to unlink '%1%'", tempLink)
+ });
if (errno == EMLINK) {
/* Some filesystems generate too many links on the rename,
rather than on the original link. (Probably it