summaryrefslogtreecommitdiffstats
path: root/sys-utils/hwclock-cmos.c
diff options
context:
space:
mode:
authorAndreas Henriksson2015-08-21 16:13:28 +0200
committerKarel Zak2015-08-24 10:55:41 +0200
commitec3d3e67d9a08533232b3ac4e07a37482a05edea (patch)
treed5d4664a8cd63fa395b028a27c649fa5901e0f0d /sys-utils/hwclock-cmos.c
parenthwclock: fix signed/unsigned comparison warning on alpha (diff)
downloadkernel-qcow2-util-linux-ec3d3e67d9a08533232b3ac4e07a37482a05edea.tar.gz
kernel-qcow2-util-linux-ec3d3e67d9a08533232b3ac4e07a37482a05edea.tar.xz
kernel-qcow2-util-linux-ec3d3e67d9a08533232b3ac4e07a37482a05edea.zip
hwclock: fix fgets unchecked return value warning on alpha
Build warning: sys-utils/hwclock-cmos.c: In function 'is_in_cpuinfo': sys-utils/hwclock-cmos.c:162:4: warning: ignoring return value of 'fgets', declared with attribute warn_unused_result [-Wunused-result] fgets(field, 256, cpuinfo); Full build log: https://buildd.debian.org/status/fetch.php?pkg=util-linux&arch=alpha&ver=2.26.2-9&stamp=1440078034 Detected by/via: https://qa.debian.org/bls/packages/u/util-linux.html This change has never actually been (build-)tested on alpha, but hopefully the change should fix the warning. Signed-off-by: Andreas Henriksson <andreas@fatal.se>
Diffstat (limited to 'sys-utils/hwclock-cmos.c')
-rw-r--r--sys-utils/hwclock-cmos.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sys-utils/hwclock-cmos.c b/sys-utils/hwclock-cmos.c
index 8d688083b..de678ab9e 100644
--- a/sys-utils/hwclock-cmos.c
+++ b/sys-utils/hwclock-cmos.c
@@ -152,15 +152,15 @@ static int is_in_cpuinfo(char *fmt, char *str)
sprintf(format, "%s : %s", fmt, "%255s");
- if ((cpuinfo = fopen("/proc/cpuinfo", "r")) != NULL) {
- while (!feof(cpuinfo)) {
+ cpuinfo = fopen("/proc/cpuinfo", "r");
+ if (cpuinfo) {
+ do {
if (fscanf(cpuinfo, format, field) == 1) {
if (strncmp(field, str, strlen(str)) == 0)
found = 1;
break;
}
- fgets(field, 256, cpuinfo);
- }
+ } while (fgets(field, 256, cpuinfo));
fclose(cpuinfo);
}
return found;