From: Andreas Henriksson <andreas@fatal.se>
To: util-linux@vger.kernel.org
Cc: Andreas Henriksson <andreas@fatal.se>
Subject: [PATCH 2/3] hwclock: fix fgets unchecked return value warning on alpha
Date: Fri, 21 Aug 2015 16:13:28 +0200 [thread overview]
Message-ID: <1440166409-32215-2-git-send-email-andreas@fatal.se> (raw)
In-Reply-To: <1440166409-32215-1-git-send-email-andreas@fatal.se>
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>
---
sys-utils/hwclock-cmos.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/sys-utils/hwclock-cmos.c b/sys-utils/hwclock-cmos.c
index 8d68808..de678ab 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;
--
2.1.4
next prev parent reply other threads:[~2015-08-21 14:22 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-21 14:13 [PATCH 1/3] hwclock: fix signed/unsigned comparison warning on alpha Andreas Henriksson
2015-08-21 14:13 ` Andreas Henriksson [this message]
2015-08-21 14:13 ` [PATCH 3/3] hwclock: fix iopl implicit declaration " Andreas Henriksson
2015-08-24 8:58 ` [PATCH 1/3] hwclock: fix signed/unsigned comparison " Karel Zak
2015-09-01 14:13 ` Andreas Henriksson
2015-09-07 6:52 ` Karel Zak
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1440166409-32215-2-git-send-email-andreas@fatal.se \
--to=andreas@fatal.se \
--cc=util-linux@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox