From ec8fc28866e9f62d3146a9b374b544dc4518fa14 Mon Sep 17 00:00:00 2001 From: bigbiff bigbiff Date: Sun, 16 Mar 2014 20:32:50 -0400 Subject: Change to lstat so we don't count the target of symbolic links as part of the tar archive size. Big thanks to Tassadar for pointing out the fix. Change-Id: I8894ffef54c93939b5b455634169d9c14d8ed7af --- twrpTar.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'twrpTar.cpp') diff --git a/twrpTar.cpp b/twrpTar.cpp index c024821ab..0dff14d89 100644 --- a/twrpTar.cpp +++ b/twrpTar.cpp @@ -570,8 +570,8 @@ int twrpTar::tarList(std::vector *TarList, unsigned thread_id) { while (i < list_size) { if (TarList->at(i).thread_id == thread_id) { strcpy(buf, TarList->at(i).fn.c_str()); - stat(buf, &st); - if (st.st_mode & S_IFREG) { // item is a regular file + lstat(buf, &st); + if (S_ISREG(st.st_mode)) { // item is a regular file if (Archive_Current_Size + (unsigned long long)(st.st_size) > MAX_ARCHIVE_SIZE) { if (closeTar() != 0) { LOGERR("Error closing '%s' on thread %i\n", tarfn.c_str(), thread_id); -- cgit v1.2.3