mirror of
https://github.com/aljazceru/lightning.git
synced 2026-02-21 22:14:20 +01:00
build: handle possible fscanf errors
on gcc (GCC) 7.4.0
devtools/create-gossipstore.c: In function ‘load_scid_file’:
devtools/create-gossipstore.c:22:9: error: ignoring return value of ‘fscanf’ ...
fscanf(scidfd, "%d\n", &n);
^~~~~~~~~~~~~~~~~~~~~~~~~~
devtools/create-gossipstore.c:24:9: error: ignoring return value of ‘fscanf’ ...
fscanf(scidfd, "%s\n", title);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make: *** [<builtin>: devtools/create-gossipstore.o] Error 1
Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
committed by
Christian Decker
parent
3d98ebbd7f
commit
6b49b17d6e
@@ -18,10 +18,14 @@
|
||||
|
||||
struct scidsat * load_scid_file(FILE * scidfd)
|
||||
{
|
||||
int n;
|
||||
fscanf(scidfd, "%d\n", &n);
|
||||
int n, ok;
|
||||
ok = fscanf(scidfd, "%d\n", &n);
|
||||
if (ok == EOF)
|
||||
return NULL;
|
||||
char title[16];
|
||||
fscanf(scidfd, "%s\n", title);
|
||||
ok = fscanf(scidfd, "%s\n", title);
|
||||
if (ok == EOF)
|
||||
return NULL;
|
||||
struct scidsat * scids = calloc(n, sizeof(scidsat));
|
||||
int i = 0;
|
||||
while(fscanf(scidfd, "%s ,%ld\n", scids[i].scid, &scids[i].sat.satoshis) == 2 ) { /* Raw: read from file */
|
||||
|
||||
Reference in New Issue
Block a user