summaryrefslogtreecommitdiffstats
path: root/twrpTar.cpp
diff options
context:
space:
mode:
authorDees_Troy <dees_troy@teamw.in>2013-02-12 16:01:53 +0100
committerDees_Troy <dees_troy@teamw.in>2013-02-12 16:01:58 +0100
commit40bbcf8ceddef436ad592ee24a1dfe9a6ee4eaac (patch)
treeefb4ae37b462a1a3b01b09d8d4b979c88145140d /twrpTar.cpp
parentAdd write buffer for tar writes (diff)
downloadandroid_bootable_recovery-40bbcf8ceddef436ad592ee24a1dfe9a6ee4eaac.tar
android_bootable_recovery-40bbcf8ceddef436ad592ee24a1dfe9a6ee4eaac.tar.gz
android_bootable_recovery-40bbcf8ceddef436ad592ee24a1dfe9a6ee4eaac.tar.bz2
android_bootable_recovery-40bbcf8ceddef436ad592ee24a1dfe9a6ee4eaac.tar.lz
android_bootable_recovery-40bbcf8ceddef436ad592ee24a1dfe9a6ee4eaac.tar.xz
android_bootable_recovery-40bbcf8ceddef436ad592ee24a1dfe9a6ee4eaac.tar.zst
android_bootable_recovery-40bbcf8ceddef436ad592ee24a1dfe9a6ee4eaac.zip
Diffstat (limited to 'twrpTar.cpp')
-rw-r--r--twrpTar.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/twrpTar.cpp b/twrpTar.cpp
index 82b24766b..263684995 100644
--- a/twrpTar.cpp
+++ b/twrpTar.cpp
@@ -20,6 +20,7 @@ extern "C" {
#include "libtar/libtar.h"
#include "twrpTar.h"
#include "tarWrite.h"
+ #include "libcrecovery/common.h"
}
#include <sys/types.h>
#include <sys/stat.h>
@@ -342,7 +343,7 @@ int twrpTar::createTar() {
DataManager::GetValue(TW_USE_COMPRESSION_VAR, use_compression);
if (use_compression) {
string cmd = "pigz - > '" + tarfn + "'";
- p = popen(cmd.c_str(), "w");
+ p = __popen(cmd.c_str(), "w");
fd = fileno(p);
if (!p) return -1;
if(tar_fdopen(&t, fd, charRootDir, &type, O_RDONLY | O_LARGEFILE, 0644, TAR_GNU) != 0) {
@@ -364,12 +365,12 @@ int twrpTar::openTar(bool gzip) {
if (gzip) {
LOGI("Opening as a gzip\n");
string cmd = "pigz -d -c '" + tarfn + "'";
- FILE* pipe = popen(cmd.c_str(), "r");
+ FILE* pipe = __popen(cmd.c_str(), "r");
int fd = fileno(pipe);
if (!pipe) return -1;
if(tar_fdopen(&t, fd, charRootDir, NULL, O_RDONLY | O_LARGEFILE, 0644, TAR_GNU) != 0) {
LOGI("tar_fdopen returned error\n");
- pclose(pipe);
+ __pclose(pipe);
return -1;
}
}
@@ -455,7 +456,7 @@ int twrpTar::removeEOT(string tarFile) {
int twrpTar::compress(string fn) {
string cmd = "pigz " + fn;
- p = popen(cmd.c_str(), "r");
+ p = __popen(cmd.c_str(), "r");
if (!p) return -1;
char buffer[128];
string result = "";
@@ -463,7 +464,7 @@ int twrpTar::compress(string fn) {
if(fgets(buffer, 128, p) != NULL)
result += buffer;
}
- pclose(p);
+ __pclose(p);
return 0;
}
@@ -483,4 +484,4 @@ int twrpTar::extractTGZ() {
extern "C" ssize_t write_tar(int fd, const void *buffer, size_t size) {
return (ssize_t) write_libtar_buffer(fd, buffer, size);
-} \ No newline at end of file
+}