diff options
Diffstat (limited to 'partition.cpp')
-rw-r--r-- | partition.cpp | 49 |
1 files changed, 2 insertions, 47 deletions
diff --git a/partition.cpp b/partition.cpp index ac0c19950..543e8674b 100644 --- a/partition.cpp +++ b/partition.cpp @@ -1,5 +1,5 @@ /* - Copyright 2013 to 2016 TeamWin + Copyright 2013 to 2017 TeamWin This file is part of TWRP/TeamWin Recovery Project. TWRP is free software: you can redistribute it and/or modify @@ -41,7 +41,6 @@ #include "partitions.hpp" #include "data.hpp" #include "twrp-functions.hpp" -#include "twrpDigest.hpp" #include "twrpTar.hpp" #include "exclude.hpp" #include "infomanager.hpp" @@ -1657,50 +1656,6 @@ bool TWPartition::Backup(PartitionSettings *part_settings, pid_t *tar_fork_pid) return false; } -bool TWPartition::Check_Restore_File_MD5(const string& Filename) { - twrpDigest md5sum; - - md5sum.setfn(Filename); - switch (md5sum.verify_md5digest()) { - case MD5_OK: - gui_msg(Msg("md5_matched=MD5 matched for '{1}'.")(Filename)); - return true; - case MD5_FILE_UNREADABLE: - case MD5_NOT_FOUND: - gui_msg(Msg(msg::kError, "no_md5_found=No md5 file found for '{1}'. Please unselect Enable MD5 verification to restore.")(Filename)); - break; - case MD5_MATCH_FAIL: - gui_msg(Msg(msg::kError, "md5_fail_match=MD5 failed to match on '{1}'.")(Filename)); - break; - } - return false; -} - -bool TWPartition::Check_MD5(PartitionSettings *part_settings) { - string Full_Filename; - char split_filename[512]; - int index = 0; - - sync(); - - Full_Filename = part_settings->Backup_Folder + "/" + Backup_FileName; - if (!TWFunc::Path_Exists(Full_Filename)) { - // This is a split archive, we presume - memset(split_filename, 0, sizeof(split_filename)); - while (index < 1000) { - sprintf(split_filename, "%s%03i", Full_Filename.c_str(), index); - if (!TWFunc::Path_Exists(split_filename)) - break; - LOGINFO("split_filename: %s\n", split_filename); - if (!Check_Restore_File_MD5(split_filename)) - return false; - index++; - } - return true; - } - return Check_Restore_File_MD5(Full_Filename); // Single file archive -} - bool TWPartition::Restore(PartitionSettings *part_settings) { TWFunc::GUI_Operation_Text(TW_RESTORE_TEXT, Display_Name, gui_parse_text("{@restoring_hdr}")); LOGINFO("Restore filename is: %s/%s\n", part_settings->Backup_Folder.c_str(), Backup_FileName.c_str()); @@ -2169,7 +2124,7 @@ bool TWPartition::Wipe_Data_Without_Wiping_Media_Func(const string& parent __unu } rmdir(dir.c_str()); } else if (de->d_type == DT_REG || de->d_type == DT_LNK || de->d_type == DT_FIFO || de->d_type == DT_SOCK) { - if (!unlink(dir.c_str())) + if (unlink(dir.c_str()) != 0) LOGINFO("Unable to unlink '%s': %s\n", dir.c_str(), strerror(errno)); } } |