summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTao Bao <tbao@google.com>2017-12-09 18:33:01 +0100
committerandroid-build-merger <android-build-merger@google.com>2017-12-09 18:33:01 +0100
commit710712f23559bd5cc987c1e4f59fc9e8205e4a02 (patch)
treec8b805ff5e40ad81b108c2d26f34b693283c223b
parentMerge "add sload.f2fs for recovery format" (diff)
parentMerge "applypatch: Remove the 'st' field from FileContents." (diff)
downloadandroid_bootable_recovery-710712f23559bd5cc987c1e4f59fc9e8205e4a02.tar
android_bootable_recovery-710712f23559bd5cc987c1e4f59fc9e8205e4a02.tar.gz
android_bootable_recovery-710712f23559bd5cc987c1e4f59fc9e8205e4a02.tar.bz2
android_bootable_recovery-710712f23559bd5cc987c1e4f59fc9e8205e4a02.tar.lz
android_bootable_recovery-710712f23559bd5cc987c1e4f59fc9e8205e4a02.tar.xz
android_bootable_recovery-710712f23559bd5cc987c1e4f59fc9e8205e4a02.tar.zst
android_bootable_recovery-710712f23559bd5cc987c1e4f59fc9e8205e4a02.zip
-rw-r--r--applypatch/applypatch.cpp18
-rw-r--r--applypatch/include/applypatch/applypatch.h2
2 files changed, 3 insertions, 17 deletions
diff --git a/applypatch/applypatch.cpp b/applypatch/applypatch.cpp
index 41a72eb15..04b964b17 100644
--- a/applypatch/applypatch.cpp
+++ b/applypatch/applypatch.cpp
@@ -58,12 +58,13 @@ int LoadFileContents(const char* filename, FileContents* file) {
return LoadPartitionContents(filename, file);
}
- if (stat(filename, &file->st) == -1) {
+ struct stat sb;
+ if (stat(filename, &sb) == -1) {
printf("failed to stat \"%s\": %s\n", filename, strerror(errno));
return -1;
}
- std::vector<unsigned char> data(file->st.st_size);
+ std::vector<unsigned char> data(sb.st_size);
unique_file f(ota_fopen(filename, "rb"));
if (!f) {
printf("failed to open \"%s\": %s\n", filename, strerror(errno));
@@ -180,10 +181,6 @@ static int LoadPartitionContents(const std::string& filename, FileContents* file
buffer.resize(buffer_size);
file->data = std::move(buffer);
- // Fake some stat() info.
- file->st.st_mode = 0644;
- file->st.st_uid = 0;
- file->st.st_gid = 0;
return 0;
}
@@ -212,15 +209,6 @@ int SaveFileContents(const char* filename, const FileContents* file) {
return -1;
}
- if (chmod(filename, file->st.st_mode) != 0) {
- printf("chmod of \"%s\" failed: %s\n", filename, strerror(errno));
- return -1;
- }
- if (chown(filename, file->st.st_uid, file->st.st_gid) != 0) {
- printf("chown of \"%s\" failed: %s\n", filename, strerror(errno));
- return -1;
- }
-
return 0;
}
diff --git a/applypatch/include/applypatch/applypatch.h b/applypatch/include/applypatch/applypatch.h
index 6d7ffd78c..c8ad91505 100644
--- a/applypatch/include/applypatch/applypatch.h
+++ b/applypatch/include/applypatch/applypatch.h
@@ -18,7 +18,6 @@
#define _APPLYPATCH_H
#include <stdint.h>
-#include <sys/stat.h>
#include <functional>
#include <memory>
@@ -33,7 +32,6 @@ struct Value;
struct FileContents {
uint8_t sha1[SHA_DIGEST_LENGTH];
std::vector<unsigned char> data;
- struct stat st;
};
// When there isn't enough room on the target filesystem to hold the patched version of the file,