diff --git a/Android.mk b/Android.mk index 2e0ffc6..44a1f03 100644 --- a/Android.mk +++ b/Android.mk @@ -26,7 +26,7 @@ LOCAL_MODULE := recovery LOCAL_FORCE_STATIC_EXECUTABLE := true -RECOVERY_VERSION := ClockworkMod Recovery v4.0.0.2 +RECOVERY_VERSION := ClockworkMod Recovery v4.0.0.3 LOCAL_CFLAGS += -DRECOVERY_VERSION="$(RECOVERY_VERSION)" RECOVERY_API_VERSION := 2 LOCAL_CFLAGS += -DRECOVERY_API_VERSION=$(RECOVERY_API_VERSION) diff --git a/nandroid.c b/nandroid.c index 5a32a76..566b535 100644 --- a/nandroid.c +++ b/nandroid.c @@ -98,13 +98,13 @@ static void compute_directory_stats(const char* directory) } typedef void (*file_event_callback)(const char* filename); -typedef int (*nandroid_backup_handler)(const char* backup_path, const char* backup_file_image, const file_event_callback callback); +typedef int (*nandroid_backup_handler)(const char* backup_path, const char* backup_file_image, int callback); -static int mkyaffs2image_wrapper(const char* backup_path, const char* backup_file_image, const file_event_callback callback) { +static int mkyaffs2image_wrapper(const char* backup_path, const char* backup_file_image, int callback) { return mkyaffs2image(backup_path, backup_file_image, 0, callback); } -static int tar_compress_wrapper(const char* backup_path, const char* backup_file_image, const file_event_callback callback) { +static int tar_compress_wrapper(const char* backup_path, const char* backup_file_image, int callback) { char tmp[PATH_MAX]; if (strcmp(backup_path, "/data") == 0 && volume_for_path("/sdcard") == NULL) sprintf(tmp, "cd $(dirname %s) ; tar cvf %s --exclude 'media' $(basename %s) ; exit $?", backup_path, backup_file_image, backup_path); @@ -119,7 +119,7 @@ static int tar_compress_wrapper(const char* backup_path, const char* backup_file while (fgets(tmp, PATH_MAX, fp) != NULL) { tmp[PATH_MAX - 1] = NULL; - if (NULL != callback) + if (callback) yaffs_callback(tmp); } @@ -163,10 +163,7 @@ int nandroid_backup_partition_extended(const char* backup_path, const char* moun char* name = basename(mount_point); struct stat file_info; - file_event_callback callback = NULL; - if (0 != stat("/sdcard/clockworkmod/.hidenandroidprogress", &file_info)) { - callback = yaffs_callback; - } + int callback = stat("/sdcard/clockworkmod/.hidenandroidprogress", &file_info) == 0; ui_print("Backing up %s...\n", name); if (0 != (ret = ensure_path_mounted(mount_point) != 0)) { @@ -388,10 +385,7 @@ int nandroid_restore_partition_extended(const char* backup_path, const char* mou ensure_directory(mount_point); - file_event_callback callback = NULL; - if (0 != stat("/sdcard/clockworkmod/.hidenandroidprogress", &file_info)) { - callback = yaffs_callback; - } + int callback = stat("/sdcard/clockworkmod/.hidenandroidprogress", &file_info) == 0; ui_print("Restoring %s...\n", name); /* diff --git a/roots.c b/roots.c index fa7a5df..6d76aa8 100644 --- a/roots.c +++ b/roots.c @@ -286,6 +286,10 @@ int ensure_path_unmounted(const char* path) { int format_volume(const char* volume) { Volume* v = volume_for_path(volume); if (v == NULL) { + // no /sdcard? let's assume /data/media + if (strstr(path, "/sdcard") == path && is_data_media()) { + return format_unknown_device(volume); + } // silent failure for sd-ext if (strcmp(volume, "/sd-ext") == 0) return -1;