From f7bf94b5d361d0a54e85673c14e630cfdf8dbe01 Mon Sep 17 00:00:00 2001 From: Azat Khuzhin Date: Mon, 12 Oct 2020 23:39:00 +0300 Subject: [PATCH] Check return value of the history_save/history_load The coding style is different and this is the intention, to make look like surrounding code. --- base/common/ReplxxLineReader.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/base/common/ReplxxLineReader.cpp b/base/common/ReplxxLineReader.cpp index 33a368c27dc..85b474e2021 100644 --- a/base/common/ReplxxLineReader.cpp +++ b/base/common/ReplxxLineReader.cpp @@ -45,7 +45,10 @@ ReplxxLineReader::ReplxxLineReader( } else { - rx.history_load(history_file_path); + if (!rx.history_load(history_file_path)) + { + rx.print("Loading history failed: %s\n", strerror(errno)); + } if (flock(history_file_fd, LOCK_UN)) { @@ -115,7 +118,8 @@ void ReplxxLineReader::addToHistory(const String & line) rx.history_add(line); // flush changes to the disk - rx.history_save(history_file_path); + if (!rx.history_save(history_file_path)) + rx.print("Saving history failed: %s\n", strerror(errno)); if (locked && 0 != flock(history_file_fd, LOCK_UN)) rx.print("Unlock of history file failed: %s\n", strerror(errno));