From 2f0ef73029fc51c6404121f338b034c8b516652c Mon Sep 17 00:00:00 2001 From: Michael Runge Date: Wed, 22 Oct 2014 14:28:23 -0700 Subject: Treat already-renamed files as having no problems. This should help with reentrant OTAs. Bug: 18079773 Change-Id: I102fd738e3b450483ecd4471384c12e89fc586e2 --- updater/install.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'updater') diff --git a/updater/install.c b/updater/install.c index dad0d08..42dbb58 100644 --- a/updater/install.c +++ b/updater/install.c @@ -358,6 +358,9 @@ Value* RenameFn(const char* name, State* state, int argc, Expr* argv[]) { if (make_parents(dst_name) != 0) { ErrorAbort(state, "Creating parent of %s failed, error %s", dst_name, strerror(errno)); + } else if (access(dst_name, F_OK) == 0 && access(src_name, F_OK) != 0) { + // File was already moved + result = dst_name; } else if (rename(src_name, dst_name) != 0) { ErrorAbort(state, "Rename of %s to %s failed, error %s", src_name, dst_name, strerror(errno)); -- cgit v1.1