Address a few compiler warnings
Change-Id: I6e063fba8d58c8c53da6bca6292c84e3392aee50
diff --git a/twrpTar.cpp b/twrpTar.cpp
index 90c7ea3..a8e75b3 100644
--- a/twrpTar.cpp
+++ b/twrpTar.cpp
@@ -1263,7 +1263,7 @@
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 @@
}
if (tar_close(t) == -1)
return -1;
- if (truncate(charTarFile, tarFileEnd) == -1)
+ if (tarFileEnd > 0 && truncate(charTarFile, tarFileEnd) == -1)
return -1;
return 0;
}