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:
Zach Brown 2014-10-15 16:14:18 -07:00 committed by David Sterba
parent bdac35cea2
commit 17063426a0
1 changed files with 6 additions and 1 deletions

View File

@ -1579,7 +1579,12 @@ scan_again:
strcpy(fullpath,"/dev/");
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