mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-10 14:08:40 +01:00
scripted-diff: return error(...); ==> error(...); return false;
This is needed for the next commit.
-BEGIN VERIFY SCRIPT-
# Separate sed invocations to replace one-line, and two-line error(...) calls
sed -i --regexp-extended 's!( +)return (error\(.*\);)!\1\2\n\1return false;!g' $( git grep -l 'return error(' )
sed -i --null-data --regexp-extended 's!( +)return (error\([^\n]*\n[^\n]*\);)!\1\2\n\1return false;!g' $( git grep -l 'return error(' )
-END VERIFY SCRIPT-
This commit is contained in:
@@ -44,7 +44,8 @@ bool SerializeDB(Stream& stream, const Data& data)
|
||||
hashwriter << Params().MessageStart() << data;
|
||||
stream << hashwriter.GetHash();
|
||||
} catch (const std::exception& e) {
|
||||
return error("%s: Serialize or I/O error - %s", __func__, e.what());
|
||||
error("%s: Serialize or I/O error - %s", __func__, e.what());
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -64,7 +65,8 @@ bool SerializeFileDB(const std::string& prefix, const fs::path& path, const Data
|
||||
if (fileout.IsNull()) {
|
||||
fileout.fclose();
|
||||
remove(pathTmp);
|
||||
return error("%s: Failed to open file %s", __func__, fs::PathToString(pathTmp));
|
||||
error("%s: Failed to open file %s", __func__, fs::PathToString(pathTmp));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Serialize
|
||||
@@ -76,14 +78,16 @@ bool SerializeFileDB(const std::string& prefix, const fs::path& path, const Data
|
||||
if (!FileCommit(fileout.Get())) {
|
||||
fileout.fclose();
|
||||
remove(pathTmp);
|
||||
return error("%s: Failed to flush file %s", __func__, fs::PathToString(pathTmp));
|
||||
error("%s: Failed to flush file %s", __func__, fs::PathToString(pathTmp));
|
||||
return false;
|
||||
}
|
||||
fileout.fclose();
|
||||
|
||||
// replace existing file, if any, with new file
|
||||
if (!RenameOver(pathTmp, path)) {
|
||||
remove(pathTmp);
|
||||
return error("%s: Rename-into-place failed", __func__);
|
||||
error("%s: Rename-into-place failed", __func__);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user