commit 35bff9489e242ebfce885a27a5616db273ada864
parent 0c0a191fcb2e127e2bbec68b5b7d21f56d65ba19
Author: sin <sin@2f30.org>
Date: Thu, 5 Sep 2013 09:53:39 +0100
Use ferror() if fgets() returns NULL
Diffstat:
2 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/lsmod.c b/lsmod.c
@@ -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;
}
diff --git a/lsusb.c b/lsusb.c
@@ -50,6 +50,8 @@ lsusb(const char *file)
break;
}
}
+ if (ferror(fp))
+ eprintf("%s: read error:", path);
fclose(fp);
}