summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--twrp-functions.cpp6
-rw-r--r--twrpTar.cpp6
2 files changed, 8 insertions, 4 deletions
diff --git a/twrp-functions.cpp b/twrp-functions.cpp
index 3e06f8770..d1f9e3dbd 100644
--- a/twrp-functions.cpp
+++ b/twrp-functions.cpp
@@ -12,7 +12,9 @@
#include <sys/sendfile.h>
#include <sys/stat.h>
#include <sys/vfs.h>
-#include "cutils/android_reboot.h"
+#ifdef ANDROID_RB_POWEROFF
+ #include "cutils/android_reboot.h"
+#endif
#include <iostream>
#include <fstream>
#include "twrp-functions.hpp"
@@ -375,7 +377,9 @@ int TWFunc::tw_reboot(RebootCommand command)
return __reboot(LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, LINUX_REBOOT_CMD_RESTART2, (void*) "bootloader");
case rb_poweroff:
check_and_run_script("/sbin/poweroff.sh", "power off");
+#ifdef ANDROID_RB_POWEROFF
android_reboot(ANDROID_RB_POWEROFF, 0, 0);
+#endif
return reboot(RB_POWER_OFF);
case rb_download:
check_and_run_script("/sbin/rebootdownload.sh", "reboot download");
diff --git a/twrpTar.cpp b/twrpTar.cpp
index 5d1752131..c4600aa4d 100644
--- a/twrpTar.cpp
+++ b/twrpTar.cpp
@@ -436,7 +436,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) {
@@ -458,7 +458,7 @@ 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) {
@@ -549,7 +549,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 = "";