From: Hui Zhu <teawater@gmail.com>
To: fengguang.wu@intel.com, linux-kernel@vger.kernel.org
Cc: Hui Zhu <teawater@gmail.com>, Hui Zhu <teawaterz@linux.alibaba.com>
Subject: [PATCH for vm-scalability] usemem: Fix the build warning
Date: Wed, 25 Dec 2019 16:34:25 +0800 [thread overview]
Message-ID: <1577262865-10253-1-git-send-email-teawater@gmail.com> (raw)
Got:
gcc -O -c -Wall -g usemem.c -o usemem.o
usemem.c: In function ‘output_statistics’:
usemem.c:638:2: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
write(1, buf, len);
This commit fixes this warning.
Signed-off-by: Hui Zhu <teawaterz@linux.alibaba.com>
---
usemem.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/usemem.c b/usemem.c
index 85dbdc5..9158304 100644
--- a/usemem.c
+++ b/usemem.c
@@ -635,7 +635,8 @@ static void output_statistics(unsigned long unit_bytes, const char *intro)
"%s%lu bytes / %lu usecs = %lu KB/s\n",
intro, unit_bytes, delta_us, throughput);
fflush(stdout);
- write(1, buf, len);
+ if (write(1, buf, len) != len)
+ printf("Output buf \"%s\" fail\n", buf);
}
static void timing_free(void *ptrs[], unsigned int nptr,
--
2.7.4
next reply other threads:[~2019-12-25 8:34 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-25 8:34 Hui Zhu [this message]
2019-12-25 8:45 ` [PATCH for vm-scalability] usemem: Fix the build warning Fengguang Wu
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=1577262865-10253-1-git-send-email-teawater@gmail.com \
--to=teawater@gmail.com \
--cc=fengguang.wu@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=teawaterz@linux.alibaba.com \
/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;
as well as URLs for NNTP newsgroup(s).