From 9069bace158f52b0bd3a679eef7f09221c3a9b2d Mon Sep 17 00:00:00 2001 From: Christian Stimming Date: Sun, 20 Jan 2019 20:39:20 +0100 Subject: [PATCH] Fix unused return value error from e4836f3c Re-introducing the fgets() call in e4836f3c that has been removed in bf55c30 triggers the "ignoring return value of fgets, declared with attribute warn_unused_result" error. The even better way is to actually use the return value and check it for non-NULL because only then we did a successful fgets call where we can use its result. --- gnucash/import-export/log-replay/gnc-log-replay.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gnucash/import-export/log-replay/gnc-log-replay.c b/gnucash/import-export/log-replay/gnc-log-replay.c index 92c2a4bb4b..d6b5c7e277 100644 --- a/gnucash/import-export/log-replay/gnc-log-replay.c +++ b/gnucash/import-export/log-replay/gnc-log-replay.c @@ -639,9 +639,9 @@ void gnc_file_log_replay (GtkWindow *parent) { do { - fgets(read_buf, sizeof(read_buf), log_file); + read_retval = fgets(read_buf, sizeof(read_buf), log_file); /*DEBUG("Chunk read: %s",read_retval);*/ - if (strncmp(record_start_str, read_buf, strlen(record_start_str)) == 0) /* If a record started */ + if (read_retval && strncmp(record_start_str, read_buf, strlen(record_start_str)) == 0) /* If a record started */ { process_trans_record(log_file); }