summaryrefslogtreecommitdiffstats
path: root/twrpTar.cpp
diff options
context:
space:
mode:
authorMatt Mower <mowerm@gmail.com>2015-02-20 23:58:05 +0100
committerDees Troy <dees_troy@teamw.in>2015-03-05 04:11:44 +0100
commit2b18a53dc8079cff8f583b6597fc8951c3a82018 (patch)
treef5043a44858aa69d55a6b6cbb0cc4691abf3b3bc /twrpTar.cpp
parentProperly initialize Archive_Current_Size to 0 in twrpTar (diff)
downloadandroid_bootable_recovery-2b18a53dc8079cff8f583b6597fc8951c3a82018.tar
android_bootable_recovery-2b18a53dc8079cff8f583b6597fc8951c3a82018.tar.gz
android_bootable_recovery-2b18a53dc8079cff8f583b6597fc8951c3a82018.tar.bz2
android_bootable_recovery-2b18a53dc8079cff8f583b6597fc8951c3a82018.tar.lz
android_bootable_recovery-2b18a53dc8079cff8f583b6597fc8951c3a82018.tar.xz
android_bootable_recovery-2b18a53dc8079cff8f583b6597fc8951c3a82018.tar.zst
android_bootable_recovery-2b18a53dc8079cff8f583b6597fc8951c3a82018.zip
Diffstat (limited to 'twrpTar.cpp')
-rw-r--r--twrpTar.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/twrpTar.cpp b/twrpTar.cpp
index 90c7ea34c..a8e75b3cb 100644
--- a/twrpTar.cpp
+++ b/twrpTar.cpp
@@ -1263,7 +1263,7 @@ int twrpTar::closeTar() {
int twrpTar::removeEOT(string tarFile) {
char* charTarFile = (char*) tarFile.c_str();
- off_t tarFileEnd;
+ off_t tarFileEnd = 0;
while (th_read(t) == 0) {
if (TH_ISREG(t))
tar_skip_regfile(t);
@@ -1271,7 +1271,7 @@ int twrpTar::removeEOT(string tarFile) {
}
if (tar_close(t) == -1)
return -1;
- if (truncate(charTarFile, tarFileEnd) == -1)
+ if (tarFileEnd > 0 && truncate(charTarFile, tarFileEnd) == -1)
return -1;
return 0;
}