diff options
author | Emmanuel Bretelle <chantra@debuntu.org> | 2010-09-06 19:49:16 +0200 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2010-10-20 11:04:51 +0200 |
commit | 111e0545436af44862e2d373a2b9f1c9523845ce (patch) | |
tree | 3d8ff1c5a1a787d56308b67ef4ace2009789962d | |
parent | 1e9b27b70ef65c36be75c5f693b1e1173b0e4917 (diff) |
Fix warning on unused fscanf return code
Relevant output of make:
gtp.c: In function ‘log_restart’:
gtp.c:697: warning: ignoring return value of ‘fscanf’, declared with
attribute warn_unused_result
Signed-off-by: Emmanuel Bretelle <chantra@debuntu.org>
-rw-r--r-- | gtp/gtp.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -676,7 +676,7 @@ int gtp_dublicate(struct gsn_t *gsn, int version, /* Perform restoration and recovery error handling as described in 29.060 */ static void log_restart(struct gsn_t *gsn) { FILE *f; - int i; + int i, rc; int counter = 0; char filename[NAMESIZE]; @@ -694,7 +694,11 @@ static void log_restart(struct gsn_t *gsn) { } else { umask(i); - fscanf(f, "%d", &counter); + rc = fscanf(f, "%d", &counter); + if (rc != 1) { + gtp_err(LOG_ERR, __FILE__, __LINE__, "fscanf failed to read counter value"); + return; + } if (fclose(f)) { gtp_err(LOG_ERR, __FILE__, __LINE__, "fclose failed: Error = %s", strerror(errno)); } |