summaryrefslogtreecommitdiffstats
path: root/updater
diff options
context:
space:
mode:
authorDoug Zongker <dougz@android.com>2012-03-22 22:32:52 +0100
committerDoug Zongker <dougz@android.com>2012-03-22 22:33:53 +0100
commitacd73ed156e6f10b96fc277738845f833c514b77 (patch)
tree402bcd00bfe2a46ddccfe48c36e1fa7b34f48cde /updater
parentrun minadbd as shell user (diff)
downloadandroid_bootable_recovery-acd73ed156e6f10b96fc277738845f833c514b77.tar
android_bootable_recovery-acd73ed156e6f10b96fc277738845f833c514b77.tar.gz
android_bootable_recovery-acd73ed156e6f10b96fc277738845f833c514b77.tar.bz2
android_bootable_recovery-acd73ed156e6f10b96fc277738845f833c514b77.tar.lz
android_bootable_recovery-acd73ed156e6f10b96fc277738845f833c514b77.tar.xz
android_bootable_recovery-acd73ed156e6f10b96fc277738845f833c514b77.tar.zst
android_bootable_recovery-acd73ed156e6f10b96fc277738845f833c514b77.zip
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);
}