summaryrefslogtreecommitdiffstats
path: root/applypatch/applypatch.cpp
diff options
context:
space:
mode:
authorTao Bao <tbao@google.com>2018-07-13 22:05:21 +0200
committerandroid-build-merger <android-build-merger@google.com>2018-07-13 22:05:21 +0200
commit399efe580621fb5c22aa163982af4b00122fa4ef (patch)
tree81909b18c39e8fa0e37f18d887a0482cef39c50a /applypatch/applypatch.cpp
parentMerge "tests: Clean up the temporary dirs post-run." am: b46e565fd8 am: d8e96f4b4d (diff)
parentMerge "applypatch: Consolidate CacheSizeCheck() and MakeFreeSpaceOnCache()." am: 624b6b6cd5 (diff)
downloadandroid_bootable_recovery-399efe580621fb5c22aa163982af4b00122fa4ef.tar
android_bootable_recovery-399efe580621fb5c22aa163982af4b00122fa4ef.tar.gz
android_bootable_recovery-399efe580621fb5c22aa163982af4b00122fa4ef.tar.bz2
android_bootable_recovery-399efe580621fb5c22aa163982af4b00122fa4ef.tar.lz
android_bootable_recovery-399efe580621fb5c22aa163982af4b00122fa4ef.tar.xz
android_bootable_recovery-399efe580621fb5c22aa163982af4b00122fa4ef.tar.zst
android_bootable_recovery-399efe580621fb5c22aa163982af4b00122fa4ef.zip
Diffstat (limited to 'applypatch/applypatch.cpp')
-rw-r--r--applypatch/applypatch.cpp12
1 files changed, 2 insertions, 10 deletions
diff --git a/applypatch/applypatch.cpp b/applypatch/applypatch.cpp
index 13e4b1ae0..12e139930 100644
--- a/applypatch/applypatch.cpp
+++ b/applypatch/applypatch.cpp
@@ -420,14 +420,6 @@ static size_t FileSink(const unsigned char* data, size_t len, int fd) {
return done;
}
-int CacheSizeCheck(size_t bytes) {
- if (MakeFreeSpaceOnCache(bytes) < 0) {
- LOG(ERROR) << "Failed to make " << bytes << " bytes available on /cache";
- return 1;
- }
- return 0;
-}
-
int applypatch(const char* source_filename, const char* target_filename,
const char* target_sha1_str, size_t /* target_size */,
const std::vector<std::string>& patch_sha1s,
@@ -562,8 +554,8 @@ static int GenerateTarget(const FileContents& source_file, const std::unique_ptr
CHECK(android::base::StartsWith(target_filename, "EMMC:"));
- // We still write the original source to cache, in case the partition write is interrupted.
- if (MakeFreeSpaceOnCache(source_file.data.size()) < 0) {
+ // We write the original source to cache, in case the partition write is interrupted.
+ if (!CheckAndFreeSpaceOnCache(source_file.data.size())) {
LOG(ERROR) << "Not enough free space on /cache";
return 1;
}