summaryrefslogtreecommitdiffstats
path: root/applypatch/applypatch.cpp
diff options
context:
space:
mode:
authorTao Bao <tbao@google.com>2016-11-29 06:21:37 +0100
committerandroid-build-merger <android-build-merger@google.com>2016-11-29 06:21:37 +0100
commit839fbbdad3fc212dbc7f907a079bb0f9893d908f (patch)
tree3ed073ab6e81a78dd7c48a7acd83ae1eef11cced /applypatch/applypatch.cpp
parentMerge "tests: Add testcases for EMMC targets." (diff)
parentMerge "Add ota_close(unique_fd&) and ota_fclose(std::unique_ptr<FILE>&)." (diff)
downloadandroid_bootable_recovery-839fbbdad3fc212dbc7f907a079bb0f9893d908f.tar
android_bootable_recovery-839fbbdad3fc212dbc7f907a079bb0f9893d908f.tar.gz
android_bootable_recovery-839fbbdad3fc212dbc7f907a079bb0f9893d908f.tar.bz2
android_bootable_recovery-839fbbdad3fc212dbc7f907a079bb0f9893d908f.tar.lz
android_bootable_recovery-839fbbdad3fc212dbc7f907a079bb0f9893d908f.tar.xz
android_bootable_recovery-839fbbdad3fc212dbc7f907a079bb0f9893d908f.tar.zst
android_bootable_recovery-839fbbdad3fc212dbc7f907a079bb0f9893d908f.zip
Diffstat (limited to 'applypatch/applypatch.cpp')
-rw-r--r--applypatch/applypatch.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/applypatch/applypatch.cpp b/applypatch/applypatch.cpp
index 41a8d582b..0250407a5 100644
--- a/applypatch/applypatch.cpp
+++ b/applypatch/applypatch.cpp
@@ -66,7 +66,7 @@ int LoadFileContents(const char* filename, FileContents* file) {
}
std::vector<unsigned char> data(file->st.st_size);
- std::unique_ptr<FILE, decltype(&ota_fclose)> f(ota_fopen(filename, "rb"), ota_fclose);
+ std::unique_ptr<FILE, int (*)(FILE*)> f(ota_fopen(filename, "rb"), ota_fclose);
if (!f) {
printf("failed to open \"%s\": %s\n", filename, strerror(errno));
return -1;
@@ -118,7 +118,7 @@ static int LoadPartitionContents(const std::string& filename, FileContents* file
std::sort(pairs.begin(), pairs.end());
const char* partition = pieces[1].c_str();
- std::unique_ptr<FILE, decltype(&ota_fclose)> dev(ota_fopen(partition, "rb"), ota_fclose);
+ std::unique_ptr<FILE, int (*)(FILE*)> dev(ota_fopen(partition, "rb"), ota_fclose);
if (!dev) {
printf("failed to open emmc partition \"%s\": %s\n", partition, strerror(errno));
return -1;
@@ -210,7 +210,7 @@ int SaveFileContents(const char* filename, const FileContents* file) {
printf("fsync of \"%s\" failed: %s\n", filename, strerror(errno));
return -1;
}
- if (ota_close(fd.release()) != 0) {
+ if (ota_close(fd) != 0) {
printf("close of \"%s\" failed: %s\n", filename, strerror(errno));
return -1;
}
@@ -268,7 +268,7 @@ int WriteToPartition(const unsigned char* data, size_t len, const std::string& t
printf("failed to sync to %s: %s\n", partition, strerror(errno));
return -1;
}
- if (ota_close(fd.release()) != 0) {
+ if (ota_close(fd) != 0) {
printf("failed to close %s: %s\n", partition, strerror(errno));
return -1;
}
@@ -287,7 +287,7 @@ int WriteToPartition(const unsigned char* data, size_t len, const std::string& t
} else {
printf(" caches dropped\n");
}
- ota_close(dc.release());
+ ota_close(dc);
sleep(1);
// Verify.
@@ -339,7 +339,7 @@ int WriteToPartition(const unsigned char* data, size_t len, const std::string& t
return -1;
}
- if (ota_close(fd.release()) == -1) {
+ if (ota_close(fd) == -1) {
printf("error closing %s: %s\n", partition, strerror(errno));
return -1;
}
@@ -782,7 +782,7 @@ static int GenerateTarget(FileContents* source_file,
printf("failed to fsync file \"%s\": %s\n", tmp_target_filename.c_str(), strerror(errno));
result = 1;
}
- if (ota_close(output_fd.release()) != 0) {
+ if (ota_close(output_fd) != 0) {
printf("failed to close file \"%s\": %s\n", tmp_target_filename.c_str(), strerror(errno));
result = 1;
}