diff options
-rw-r--r-- | Android.mk | 14 | ||||
-rw-r--r-- | partition.cpp | 14 | ||||
-rw-r--r-- | prebuilt/Android.mk | 4 | ||||
-rw-r--r-- | twrp-functions.cpp | 16 |
4 files changed, 32 insertions, 16 deletions
diff --git a/Android.mk b/Android.mk index 795b19deb..3cfd1fbfa 100644 --- a/Android.mk +++ b/Android.mk @@ -62,7 +62,7 @@ LOCAL_C_INCLUDES += bionic external/stlport/stlport LOCAL_STATIC_LIBRARIES := LOCAL_SHARED_LIBRARIES := -LOCAL_STATIC_LIBRARIES += libmtdutils +LOCAL_STATIC_LIBRARIES += libmtdutils libcrecovery LOCAL_STATIC_LIBRARIES += libminadbd libminzip libunz LOCAL_STATIC_LIBRARIES += libminuitwrp libpixelflinger_static libpng libjpegtwrp libgui LOCAL_SHARED_LIBRARIES += libz libc libstlport libcutils libstdc++ libmincrypt libext4_utils libtar @@ -282,10 +282,7 @@ include $(commands_recovery_local_path)/libjpegtwrp/Android.mk \ $(commands_recovery_local_path)/crypto/cryptsettings/Android.mk \ $(commands_recovery_local_path)/crypto/cryptfs/Android.mk \ $(commands_recovery_local_path)/libcrecovery/Android.mk \ - $(commands_recovery_local_path)/twmincrypt/Android.mk \ - $(commands_recovery_local_path)/exfat/mkfs/Android.mk \ - $(commands_recovery_local_path)/fuse/Android.mk \ - $(commands_recovery_local_path)/exfat/libexfat/Android.mk + $(commands_recovery_local_path)/twmincrypt/Android.mk ifeq ($(TW_INCLUDE_CRYPTO_SAMSUNG), true) include $(commands_recovery_local_path)/crypto/libcrypt_samsung/Android.mk @@ -295,8 +292,11 @@ ifeq ($(TW_INCLUDE_JB_CRYPTO), true) include $(commands_recovery_local_path)/crypto/fs_mgr/Android.mk endif -ifeq ($(TW_INCLUDE_FUSE_EXFAT), true) - include $(commands_recovery_local_path)/exfat/exfat-fuse/Android.mk +ifneq ($(TW_NO_EXFAT), true) + include $(commands_recovery_local_path)/exfat/exfat-fuse/Android.mk \ + $(commands_recovery_local_path)/exfat/mkfs/Android.mk \ + $(commands_recovery_local_path)/fuse/Android.mk \ + $(commands_recovery_local_path)/exfat/libexfat/Android.mk endif commands_recovery_local_path := diff --git a/partition.cpp b/partition.cpp index e419579ca..16bc5dcda 100644 --- a/partition.cpp +++ b/partition.cpp @@ -274,7 +274,6 @@ bool TWPartition::Process_Fstab_Line(string Line, bool Display_Error) { Is_Storage = true; Storage_Path = EXPAND(TW_EXTERNAL_STORAGE_PATH); Removable = true; - } #else if (Mount_Point == "/sdcard") { Is_Storage = true; @@ -284,8 +283,13 @@ bool TWPartition::Process_Fstab_Line(string Line, bool Display_Error) { Setup_AndSec(); Mount_Storage_Retry(); #endif - } #endif + // blkid cannot detect exfat so we force exfat at the start if exfat support is present + if (TWFunc::Path_Exists("/sbin/exfat-fuse") && (Fstab_File_System == "vfat" || Fstab_File_System == "auto")) { + Fstab_File_System = "exfat"; + Current_File_System = Fstab_File_System; + } + } #ifdef TW_INTERNAL_STORAGE_PATH if (Mount_Point == EXPAND(TW_INTERNAL_STORAGE_PATH)) { Is_Storage = true; @@ -718,7 +722,10 @@ bool TWPartition::Mount(bool Display_Error) { LOGI("Unable to mount ecryptfs for '%s'\n", Mount_Point.c_str()); } else { LOGI("Successfully mounted ecryptfs for '%s'\n", Mount_Point.c_str()); + Is_Decrypted = true; } + } else { + Is_Decrypted = false; } #endif if (Removable) @@ -758,7 +765,8 @@ bool TWPartition::UnMount(bool Display_Error) { if (!Symlink_Mount_Point.empty()) umount(Symlink_Mount_Point.c_str()); - if (umount(Mount_Point.c_str()) != 0) { + umount(Mount_Point.c_str()); + if (Is_Mounted()) { if (Display_Error) LOGE("Unable to unmount '%s'\n", Mount_Point.c_str()); else diff --git a/prebuilt/Android.mk b/prebuilt/Android.mk index 57374318b..5e78b349f 100644 --- a/prebuilt/Android.mk +++ b/prebuilt/Android.mk @@ -44,10 +44,10 @@ RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libflashutils.so RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libstlport.so RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libmincrypt.so RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libext4_utils.so -RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/sbin/mkexfatfs -ifeq ($(TW_INCLUDE_FUSE_EXFAT), true) +ifneq ($(TW_NO_EXFAT), true) RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/sbin/exfat-fuse + RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/sbin/mkexfatfs endif ifeq ($(TW_INCLUDE_BLOBPACK), true) RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/sbin/blobpack 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; } |