From: Heiko Carstens <heiko.carstens@de.ibm.com>
To: Karel Zak <kzak@redhat.com>
Cc: util-linux@vger.kernel.org
Subject: Re: [PATCH 2/6] chcpu: convert to use lib/path.c
Date: Fri, 16 Sep 2011 10:28:43 +0200 [thread overview]
Message-ID: <20110916082843.GA12600@osiris.boeblingen.de.ibm.com> (raw)
In-Reply-To: <1316069554-20977-3-git-send-email-heiko.carstens@de.ibm.com>
> int
> +path_writestr(const char *str, const char *path, ...)
> +{
> + int fd, result;
> + va_list ap;
> +
> + va_start(ap, path);
> + fd = path_vopen(O_WRONLY, path, ap);
> + va_end(ap);
> + result = write(fd, str, strlen(str));
> + close(fd);
> + return result;
> +}
Hmm, this is not ok. The patch below is needed on top. Sorry...
Subject: [PATCH] lib,path: use write_all()
From: Heiko Carstens <heiko.carstens@de.ibm.com>
Since write() doesn't necessarily write the complete buffer with
one call we better use write_all() which takes care of this.
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
---
lib/path.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/lib/path.c b/lib/path.c
index e2bb398..54b8942 100644
--- a/lib/path.c
+++ b/lib/path.c
@@ -27,6 +27,7 @@
#include <stdio.h>
#include <errno.h>
+#include "writeall.h"
#include "cpuset.h"
#include "path.h"
#include "nls.h"
@@ -132,7 +133,7 @@ path_writestr(const char *str, const char *path, ...)
va_start(ap, path);
fd = path_vopen(O_WRONLY, path, ap);
va_end(ap);
- result = write(fd, str, strlen(str));
+ result = write_all(fd, str, strlen(str));
close(fd);
return result;
}
--
1.7.5.4
next prev parent reply other threads:[~2011-09-16 8:28 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-15 6:52 [PATCH 0/6] more lscpu and chcpu changes Heiko Carstens
2011-09-15 6:52 ` [PATCH 1/6] lib,path: move path access functions from lscpu into lib/path.c Heiko Carstens
2011-09-15 6:52 ` [PATCH 2/6] chcpu: convert to use lib/path.c Heiko Carstens
2011-09-16 8:28 ` Heiko Carstens [this message]
2011-09-15 6:52 ` [PATCH 3/6] chcpu: provide better user feedback Heiko Carstens
2011-09-15 6:52 ` [PATCH 4/6] lscpu: fix -e output Heiko Carstens
2011-09-15 6:52 ` [PATCH 5/6] lscpu: add --offline option Heiko Carstens
2011-09-15 6:52 ` [PATCH 6/6] lscpu: stricter command line parsing Heiko Carstens
2011-09-27 13:00 ` [PATCH 0/6] more lscpu and chcpu changes 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=20110916082843.GA12600@osiris.boeblingen.de.ibm.com \
--to=heiko.carstens@de.ibm.com \
--cc=kzak@redhat.com \
--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;
as well as URLs for NNTP newsgroup(s).