summaryrefslogtreecommitdiffstats
path: root/twrp-functions.cpp
diff options
context:
space:
mode:
authorDees_Troy <dees_troy@teamw.in>2012-09-20 18:13:34 +0200
committerDees_Troy <dees_troy@teamw.in>2012-09-20 18:14:56 +0200
commit2a92358be32b89887738f1618f453d92051bda23 (patch)
tree8b283291c0796a23463ac938cb9cf5006119cd28 /twrp-functions.cpp
parentAdd and improve OpenRecoveryScript support (diff)
downloadandroid_bootable_recovery-2a92358be32b89887738f1618f453d92051bda23.tar
android_bootable_recovery-2a92358be32b89887738f1618f453d92051bda23.tar.gz
android_bootable_recovery-2a92358be32b89887738f1618f453d92051bda23.tar.bz2
android_bootable_recovery-2a92358be32b89887738f1618f453d92051bda23.tar.lz
android_bootable_recovery-2a92358be32b89887738f1618f453d92051bda23.tar.xz
android_bootable_recovery-2a92358be32b89887738f1618f453d92051bda23.tar.zst
android_bootable_recovery-2a92358be32b89887738f1618f453d92051bda23.zip
Diffstat (limited to 'twrp-functions.cpp')
-rw-r--r--twrp-functions.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/twrp-functions.cpp b/twrp-functions.cpp
index 90c60165e..0b2258a90 100644
--- a/twrp-functions.cpp
+++ b/twrp-functions.cpp
@@ -25,11 +25,10 @@ int TWFunc::Check_MD5(string File) {
size_t pos;
MD5_File = File + ".md5";
- if (access(MD5_File.c_str(), F_OK ) != -1) {
+ if (Path_Exists(MD5_File)) {
DirPath = Get_Path(File);
- chdir(DirPath.c_str());
MD5_File = Get_Filename(MD5_File);
- Command = "/sbin/busybox md5sum -c '" + MD5_File + "' > /tmp/md5output";
+ Command = "cd '" + DirPath + "' && /sbin/busybox md5sum -c '" + MD5_File + "' > /tmp/md5output";
system(Command.c_str());
FILE * cs = fopen("/tmp/md5output", "r");
if (cs == NULL) {
@@ -38,6 +37,7 @@ int TWFunc::Check_MD5(string File) {
}
fgets(line, sizeof(line), cs);
+ fclose(cs);
Sline = line;
pos = Sline.find(":");
@@ -56,7 +56,6 @@ int TWFunc::Check_MD5(string File) {
// MD5 is bad, return 0
ret = 0;
}
- fclose(cs);
} else {
//No md5 file, return -1
ret = -1;