summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Runge <mrunge@google.com>2014-07-22 02:40:02 +0200
committerMichael Runge <mrunge@google.com>2014-07-22 03:02:06 +0200
commitd29f641b1c4809c0f074a179286e163d376a289e (patch)
tree0c44c214421c03f2e34ef529f05b419d20a693c8
parentdo sdcard sideloading through the fuse filesystem (diff)
downloadandroid_bootable_recovery-d29f641b1c4809c0f074a179286e163d376a289e.tar
android_bootable_recovery-d29f641b1c4809c0f074a179286e163d376a289e.tar.gz
android_bootable_recovery-d29f641b1c4809c0f074a179286e163d376a289e.tar.bz2
android_bootable_recovery-d29f641b1c4809c0f074a179286e163d376a289e.tar.lz
android_bootable_recovery-d29f641b1c4809c0f074a179286e163d376a289e.tar.xz
android_bootable_recovery-d29f641b1c4809c0f074a179286e163d376a289e.tar.zst
android_bootable_recovery-d29f641b1c4809c0f074a179286e163d376a289e.zip
-rw-r--r--updater/install.c8
-rw-r--r--updater/install.h2
2 files changed, 7 insertions, 3 deletions
diff --git a/updater/install.c b/updater/install.c
index edc386dc6..5025881d2 100644
--- a/updater/install.c
+++ b/updater/install.c
@@ -357,8 +357,10 @@ Value* RenameFn(const char* name, State* state, int argc, Expr* argv[]) {
name);
goto done;
}
-
- if (rename(src_name, dst_name) != 0) {
+ if (make_parents(dst_name) != 0) {
+ ErrorAbort(state, "Creating parent of %s() failed, error %s()",
+ dst_name, strerror(errno));
+ } else if (rename(src_name, dst_name) != 0) {
ErrorAbort(state, "Rename of %s() to %s() failed, error %s()",
src_name, dst_name, strerror(errno));
} else {
@@ -642,7 +644,7 @@ static int make_parents(char* name) {
*p = '\0';
if (make_parents(name) < 0) return -1;
int result = mkdir(name, 0700);
- if (result == 0) printf("symlink(): created [%s]\n", name);
+ if (result == 0) printf("created [%s]\n", name);
*p = '/';
if (result == 0 || errno == EEXIST) {
// successfully created or already existed; we're done
diff --git a/updater/install.h b/updater/install.h
index 94f344f8e..659c8b41c 100644
--- a/updater/install.h
+++ b/updater/install.h
@@ -19,4 +19,6 @@
void RegisterInstallFunctions();
+static int make_parents(char* name);
+
#endif