CID 22437 Unchecked return value from library

github issue #332
This commit is contained in:
Enno Rehling 2015-11-04 11:45:13 +01:00
parent 87a47e241c
commit 731dac3363
2 changed files with 5 additions and 2 deletions

View File

@ -553,8 +553,11 @@ int current_turn(void)
perror(zText);
}
else {
fscanf(F, "%d\n", &cturn);
int c = fscanf(F, "%d\n", &cturn);
fclose(F);
if (c != 1) {
return -1;
}
}
return cturn;
}

View File

@ -51,7 +51,7 @@ extern "C" {
extern int data_version;
extern int enc_gamedata;
extern int current_turn(void);
int current_turn(void);
extern void read_items(struct storage *store, struct item **it);
extern void write_items(struct storage *store, struct item *it);