All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wei Liu <wei.liu2@citrix.com>
To: xen-devel@lists.xen.org
Cc: Ian Jackson <ian.jackson@eu.citrix.com>,
	andrew.cooper3@citrix.com, Wei Liu <wei.liu2@citrix.com>,
	Ian Campbell <ian.campbell@citrix.com>,
	Charles Arnold <carnold@suse.com>
Subject: [PATCH v2 4/4] libxenstat: qmp_read fix and cleanup
Date: Wed, 8 Apr 2015 17:08:22 +0100	[thread overview]
Message-ID: <1428509302-10081-5-git-send-email-wei.liu2@citrix.com> (raw)
In-Reply-To: <1428509302-10081-1-git-send-email-wei.liu2@citrix.com>

The second argument of poll(2) is the number of file descriptors. POLLIN
is defined as 1 so it happens to work. Also reduce the size of array to
one as there is only one file descriptor.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Charles Arnold <carnold@suse.com>
---
 tools/xenstat/libxenstat/src/xenstat_qmp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/xenstat/libxenstat/src/xenstat_qmp.c b/tools/xenstat/libxenstat/src/xenstat_qmp.c
index 8d91fef..5e261af 100644
--- a/tools/xenstat/libxenstat/src/xenstat_qmp.c
+++ b/tools/xenstat/libxenstat/src/xenstat_qmp.c
@@ -289,13 +289,13 @@ static size_t qmp_write(int qfd, char *cmd, size_t cmd_len)
 static int qmp_read(int qfd, unsigned char **qstats)
 {
 	unsigned char buf[1024], *ptr;
-	struct pollfd pfd[2];
+	struct pollfd pfd[1];
 	int n, qsize = 0;
 
 	*qstats = NULL;
 	pfd[0].fd = qfd;
 	pfd[0].events = POLLIN;
-	while ((n = poll(pfd, POLLIN, 10)) > 0) {
+	while ((n = poll(pfd, 1, 10)) > 0) {
 		if (pfd[0].revents & POLLIN) {
 			if ((n = read(qfd, buf, sizeof(buf))) < 0) {
 				free(*qstats);
-- 
1.9.1

  parent reply	other threads:[~2015-04-08 16:08 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-08 16:08 [PATCH v2 0/4] libxenstat bug fixes and cleanups Wei Liu
2015-04-08 16:08 ` [PATCH v2 1/4] libxenstat: reuse xc_handle open in xenstat_init Wei Liu
2015-04-08 16:11   ` Andrew Cooper
2015-04-08 16:08 ` [PATCH v2 2/4] libxenstat: YAJL_GET_STRING may return NULL Wei Liu
2015-04-08 16:08 ` [PATCH v2 3/4] libxenstat: always free qmp_stats Wei Liu
2015-04-08 16:08 ` Wei Liu [this message]
2015-04-08 16:11   ` [PATCH v2 4/4] libxenstat: qmp_read fix and cleanup Andrew Cooper
2015-04-15 16:27 ` [PATCH v2 0/4] libxenstat bug fixes and cleanups Ian Campbell

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=1428509302-10081-5-git-send-email-wei.liu2@citrix.com \
    --to=wei.liu2@citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=carnold@suse.com \
    --cc=ian.campbell@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=xen-devel@lists.xen.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.