btrfs-progs: check sscanf return code
coverity warned that the return code from sscanf() assigned to 'i' wasn't checked before being assigned again. Check it. Signed-off-by: Zach Brown <zab@zabbo.net> Signed-off-by: David Sterba <dsterba@suse.cz>
This commit is contained in:
parent
bdac35cea2
commit
17063426a0
7
utils.c
7
utils.c
|
@ -1579,7 +1579,12 @@ scan_again:
|
||||||
|
|
||||||
strcpy(fullpath,"/dev/");
|
strcpy(fullpath,"/dev/");
|
||||||
while(fgets(buf, 1023, proc_partitions)) {
|
while(fgets(buf, 1023, proc_partitions)) {
|
||||||
i = sscanf(buf," %*d %*d %*d %99s", fullpath+5);
|
ret = sscanf(buf," %*d %*d %*d %99s", fullpath + 5);
|
||||||
|
if (ret != 1) {
|
||||||
|
fprintf(stderr,
|
||||||
|
"failed to scan device name from /proc/partitions\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* multipath and MD devices may register as a btrfs filesystem
|
* multipath and MD devices may register as a btrfs filesystem
|
||||||
|
|
Loading…
Reference in New Issue