diff options
Diffstat (limited to '')
-rw-r--r-- | twrpTar.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/twrpTar.cpp b/twrpTar.cpp index dcbb28202..d192f2cc5 100644 --- a/twrpTar.cpp +++ b/twrpTar.cpp @@ -21,7 +21,6 @@ extern "C" { #include "libtar/libtar.h" #include "twrpTar.h" #include "tarWrite.h" - #include "set_metadata.h" } #include <sys/types.h> #include <sys/stat.h> @@ -51,9 +50,7 @@ extern "C" { #ifndef BUILD_TWRPTAR_MAIN #include "data.hpp" #include "infomanager.hpp" -extern "C" { - #include "set_metadata.h" -} +#include "set_metadata.h" #endif //ndef BUILD_TWRPTAR_MAIN using namespace std; @@ -69,6 +66,9 @@ twrpTar::twrpTar(void) { Total_Backup_Size = 0; Archive_Current_Size = 0; include_root_dir = true; + tar_type.openfunc = open; + tar_type.closefunc = close; + tar_type.readfunc = read; } twrpTar::~twrpTar(void) { @@ -961,7 +961,7 @@ int twrpTar::createTar() { close(pipes[3]); fd = pipes[1]; init_libtar_no_buffer(progress_pipe_fd); - tar_type = { open, close, read, write_tar_no_buffer }; + tar_type.writefunc = write_tar_no_buffer; if(tar_fdopen(&t, fd, charRootDir, &tar_type, O_WRONLY | O_CREAT | O_EXCL | O_LARGEFILE, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH, TAR_GNU | TAR_STORE_SELINUX) != 0) { close(fd); LOGINFO("tar_fdopen failed\n"); @@ -1021,7 +1021,7 @@ int twrpTar::createTar() { close(pigzfd[0]); // close parent input fd = pigzfd[1]; // copy parent output init_libtar_no_buffer(progress_pipe_fd); - tar_type = { open, close, read, write_tar_no_buffer }; + tar_type.writefunc = write_tar_no_buffer; if(tar_fdopen(&t, fd, charRootDir, &tar_type, O_WRONLY | O_CREAT | O_EXCL | O_LARGEFILE, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH, TAR_GNU | TAR_STORE_SELINUX) != 0) { close(fd); LOGINFO("tar_fdopen failed\n"); @@ -1071,7 +1071,7 @@ int twrpTar::createTar() { close(oaesfd[0]); // close parent input fd = oaesfd[1]; // copy parent output init_libtar_no_buffer(progress_pipe_fd); - tar_type = { open, close, read, write_tar_no_buffer }; + tar_type.writefunc = write_tar_no_buffer; if(tar_fdopen(&t, fd, charRootDir, &tar_type, O_WRONLY | O_CREAT | O_EXCL | O_LARGEFILE, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH, TAR_GNU | TAR_STORE_SELINUX) != 0) { close(fd); LOGINFO("tar_fdopen failed\n"); @@ -1083,10 +1083,9 @@ int twrpTar::createTar() { } else { // Not compressed or encrypted init_libtar_buffer(0, progress_pipe_fd); - tar_type = { open, close, read, write_tar }; if (part_settings->adbbackup) { LOGINFO("Opening TW_ADB_BACKUP uncompressed stream\n"); - tar_type = { open, close, read, write_tar_no_buffer }; + tar_type.writefunc = write_tar_no_buffer; output_fd = open(TW_ADB_BACKUP, O_WRONLY); if(tar_fdopen(&t, output_fd, charRootDir, &tar_type, O_WRONLY | O_CREAT | O_EXCL | O_LARGEFILE, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH, TAR_GNU | TAR_STORE_SELINUX) != 0) { close(output_fd); @@ -1095,6 +1094,7 @@ int twrpTar::createTar() { } } else { + tar_type.writefunc = write_tar; if (tar_open(&t, charTarFile, &tar_type, O_WRONLY | O_CREAT | O_LARGEFILE, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH, TAR_GNU | TAR_STORE_SELINUX) == -1) { LOGERR("tar_open error opening '%s'\n", tarfn.c_str()); gui_err("backup_error=Error creating backup."); |