summaryrefslogtreecommitdiffstats
path: root/updater/install.c
diff options
context:
space:
mode:
authorDoug Zongker <dougz@android.com>2012-03-22 22:48:59 +0100
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-03-22 22:48:59 +0100
commitb2364342a05a689bc302bfcd7d5d15f528eb772c (patch)
treee3f4f58e0f6b8d0195905a048a4952954326e78e /updater/install.c
parentMerge remote-tracking branch 'goog/ics-aah-exp' (diff)
parentfail edify script if set_perm() or symlink() fails (diff)
downloadandroid_bootable_recovery-b2364342a05a689bc302bfcd7d5d15f528eb772c.tar
android_bootable_recovery-b2364342a05a689bc302bfcd7d5d15f528eb772c.tar.gz
android_bootable_recovery-b2364342a05a689bc302bfcd7d5d15f528eb772c.tar.bz2
android_bootable_recovery-b2364342a05a689bc302bfcd7d5d15f528eb772c.tar.lz
android_bootable_recovery-b2364342a05a689bc302bfcd7d5d15f528eb772c.tar.xz
android_bootable_recovery-b2364342a05a689bc302bfcd7d5d15f528eb772c.tar.zst
android_bootable_recovery-b2364342a05a689bc302bfcd7d5d15f528eb772c.zip
Diffstat (limited to 'updater/install.c')
-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);
}