summaryrefslogtreecommitdiffstats
path: root/twrp-functions.cpp
diff options
context:
space:
mode:
authorDees_Troy <dees_troy@teamw.in>2013-01-28 21:24:50 +0100
committerDees_Troy <dees_troy@teamw.in>2013-01-28 21:45:11 +0100
commitb05ddeedd383e3dab9e45b174e9e3f3cb6cd1ea5 (patch)
tree3fbfaa1bbfee4398d892972857e9900b279e5b4d /twrp-functions.cpp
parentFix subpartitionof flag (diff)
downloadandroid_bootable_recovery-b05ddeedd383e3dab9e45b174e9e3f3cb6cd1ea5.tar
android_bootable_recovery-b05ddeedd383e3dab9e45b174e9e3f3cb6cd1ea5.tar.gz
android_bootable_recovery-b05ddeedd383e3dab9e45b174e9e3f3cb6cd1ea5.tar.bz2
android_bootable_recovery-b05ddeedd383e3dab9e45b174e9e3f3cb6cd1ea5.tar.lz
android_bootable_recovery-b05ddeedd383e3dab9e45b174e9e3f3cb6cd1ea5.tar.xz
android_bootable_recovery-b05ddeedd383e3dab9e45b174e9e3f3cb6cd1ea5.tar.zst
android_bootable_recovery-b05ddeedd383e3dab9e45b174e9e3f3cb6cd1ea5.zip
Diffstat (limited to '')
-rw-r--r--twrp-functions.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/twrp-functions.cpp b/twrp-functions.cpp
index 5473c8d66..0c4471ac7 100644
--- a/twrp-functions.cpp
+++ b/twrp-functions.cpp
@@ -21,20 +21,28 @@
#include "bootloader.h"
#include "variables.h"
+extern "C" {
+ #include "libcrecovery/common.h"
+}
+
/* Execute a command */
int TWFunc::Exec_Cmd(string cmd, string &result) {
FILE* exec;
- char buffer[128];
+ char buffer[130];
int ret = 0;
- exec = popen(cmd.c_str(), "r");
+ exec = __popen(cmd.c_str(), "r");
if (!exec) return -1;
while(!feof(exec)) {
- if (fgets(buffer, 128, exec) != NULL)
+ memset(&buffer, 0, sizeof(buffer));
+ if (fgets(buffer, 128, exec) != NULL) {
+ buffer[128] = '\n';
+ buffer[129] = NULL;
result += buffer;
+ }
}
- ret = pclose(exec);
+ ret = __pclose(exec);
return ret;
}