From 40bbcf8ceddef436ad592ee24a1dfe9a6ee4eaac Mon Sep 17 00:00:00 2001 From: Dees_Troy Date: Tue, 12 Feb 2013 15:01:53 +0000 Subject: Change popen in twrpTar to __popen Change-Id: I921b0647b1f63dd348b059eb630ebe9bf5ec570d --- twrpTar.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'twrpTar.cpp') 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 #include @@ -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 +} -- cgit v1.2.3