summaryrefslogtreecommitdiffstats
path: root/updater
diff options
context:
space:
mode:
Diffstat (limited to 'updater')
-rw-r--r--updater/install.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/updater/install.c b/updater/install.c
index c087d4ebe..7b7bfc903 100644
--- a/updater/install.c
+++ b/updater/install.c
@@ -450,21 +450,27 @@ Value* SymlinkFn(const char* name, State* state, int argc, Expr* argv[]) {
return NULL;
}
+ int bad = 0;
int i;
for (i = 0; i < argc-1; ++i) {
if (unlink(srcs[i]) < 0) {
if (errno != ENOENT) {
fprintf(stderr, "%s: failed to remove %s: %s\n",
name, srcs[i], strerror(errno));
+ ++bad;
}
}
if (symlink(target, srcs[i]) < 0) {
fprintf(stderr, "%s: failed to symlink %s to %s: %s\n",
name, srcs[i], target, strerror(errno));
+ ++bad;
}
free(srcs[i]);
}
free(srcs);
+ if (bad) {
+ return ErrorAbort(state, "%s: some symlinks failed", name);
+ }
return StringValue(strdup(""));
}
@@ -483,6 +489,7 @@ Value* SetPermFn(const char* name, State* state, int argc, Expr* argv[]) {
char* end;
int i;
+ int bad = 0;
int uid = strtoul(args[0], &end, 0);
if (*end != '\0' || args[0][0] == 0) {
@@ -524,10 +531,12 @@ Value* SetPermFn(const char* name, State* state, int argc, Expr* argv[]) {
if (chown(args[i], uid, gid) < 0) {
fprintf(stderr, "%s: chown of %s to %d %d failed: %s\n",
name, args[i], uid, gid, strerror(errno));
+ ++bad;
}
if (chmod(args[i], mode) < 0) {
fprintf(stderr, "%s: chmod of %s to %o failed: %s\n",
name, args[i], mode, strerror(errno));
+ ++bad;
}
}
}
@@ -539,6 +548,10 @@ done:
}
free(args);
+ if (bad) {
+ free(result);
+ return ErrorAbort(state, "%s: some changes failed", name);
+ }
return StringValue(result);
}