Permalink
Browse files

only erase boot if we have a image to restore

  • Loading branch information...
1 parent b9170e4 commit b714b7cac76634499ed515cae9ba2322aff847a1 @coolya coolya committed Dec 30, 2010
Showing with 13 additions and 7 deletions.
  1. +13 −7 nandroid.c
View
@@ -273,14 +273,20 @@ int nandroid_restore(const char* backup_path, int restore_boot, int restore_syst
#ifndef BOARD_RECOVERY_IGNORE_BOOTABLES
if (restore_boot)
{
- ui_print("Erasing boot before restore...\n");
- if (0 != (ret = format_device("boot")))
- return print_and_error("Error while formatting BOOT:!\n");
+ struct stat file_info;
sprintf(tmp, "%s/boot.img", backup_path);
- ui_print("Restoring boot image...\n");
- if (0 != (ret = restore_raw_partition("boot", tmp))) {
- ui_print("Error while flashing boot image!");
- return ret;
+ if(statfs(tmp, &file_info) != 0)
+ {
+ ui_print("Erasing boot before restore...\n");
+ if (0 != (ret = format_device("boot")))
+ return print_and_error("Error while formatting BOOT:!\n");
+ ui_print("Restoring boot image...\n");
+ if (0 != (ret = restore_raw_partition("boot", tmp))) {
+ ui_print("Error while flashing boot image!");
+ return ret;
+ }
+ } else {
+ ui_print("No Bootimage found skipping.");
}
}
#endif

0 comments on commit b714b7c

Please sign in to comment.