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.
This commit is contained in:
Azat Khuzhin 2020-10-12 23:39:00 +03:00
parent f211d33841
commit f7bf94b5d3

View File

@ -45,7 +45,10 @@ ReplxxLineReader::ReplxxLineReader(
} }
else 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)) if (flock(history_file_fd, LOCK_UN))
{ {
@ -115,7 +118,8 @@ void ReplxxLineReader::addToHistory(const String & line)
rx.history_add(line); rx.history_add(line);
// flush changes to the disk // 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)) if (locked && 0 != flock(history_file_fd, LOCK_UN))
rx.print("Unlock of history file failed: %s\n", strerror(errno)); rx.print("Unlock of history file failed: %s\n", strerror(errno));