Use ferror() if fgets() returns NULL

This commit is contained in:
sin 2013-09-05 09:53:39 +01:00
parent 0c0a191fcb
commit 35bff9489e
2 changed files with 4 additions and 0 deletions

View File

@ -45,6 +45,8 @@ main(int argc, char *argv[])
printf("%-20s%8s%3s %s\n", name, size, refcount,
users);
}
if (ferror(fp))
eprintf("%s: read error:", modfile);
fclose(fp);
return 0;
}

View File

@ -50,6 +50,8 @@ lsusb(const char *file)
break;
}
}
if (ferror(fp))
eprintf("%s: read error:", path);
fclose(fp);
}