diff options
Diffstat (limited to '')
-rw-r--r-- | twrpTar.cpp | 4 |
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; } |