From 307c5ec85bfec4561e104f9e36920cb7d793ffbd Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Tue, 3 Nov 2015 22:56:05 +0100 Subject: [PATCH] CID 22435 Unchecked return value from library --- src/kernel/save.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/kernel/save.c b/src/kernel/save.c index 45e9902ca..505120e32 100644 --- a/src/kernel/save.c +++ b/src/kernel/save.c @@ -1428,9 +1428,14 @@ int readgame(const char *filename, bool backup) READ_INT(&store, &gameid); if (gameid != game_id()) { - log_warning("game mismatch: datafile contains game %d, but config is for %d\n", gameid, game_id()); + int c; + log_warning("game mismatch: datafile contains game %d, but config is for %d", gameid, game_id()); printf("WARNING: invalid game id. any key to continue, Ctrl-C to stop\n"); - getchar(); + c = getchar(); + if (c == EOF) { + log_error("aborting."); + abort(); + } } } else {