mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 21:35:11 +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:
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 */
|
||||
|
Loading…
Reference in New Issue
Block a user