aboutsummaryrefslogtreecommitdiffstats
path: root/applypatch/applypatch.c
diff options
context:
space:
mode:
Diffstat (limited to 'applypatch/applypatch.c')
-rw-r--r--applypatch/applypatch.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/applypatch/applypatch.c b/applypatch/applypatch.c
index 2c86e098..53890177 100644
--- a/applypatch/applypatch.c
+++ b/applypatch/applypatch.c
@@ -61,7 +61,7 @@ int LoadFileContents(const char* filename, FileContents* file) {
if (stat(filename, &file->st) != 0) {
printf("failed to stat \"%s\": %s\n", filename, strerror(errno));
- return -1;
+ return (errno == ENOENT ? -ENOENT : -1);
}
file->size = file->st.st_size;
@@ -584,7 +584,12 @@ int applypatch_check(const char* filename,
// LoadFileContents is successful. (Useful for reading
// partitions, where the filename encodes the sha1s; no need to
// check them twice.)
- if (LoadFileContents(filename, &file) != 0 ||
+ int filestate = LoadFileContents(filename, &file);
+ if (filestate == -ENOENT) {
+ return -ENOENT;
+ }
+
+ if (filestate != 0 ||
(num_patches > 0 &&
FindMatchingPatch(file.sha1, patch_sha1_str, num_patches) < 0)) {
printf("file \"%s\" doesn't have any of expected "