From nobody Mon Feb 9 00:20:17 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1612179012; cv=none; d=zohomail.com; s=zohoarc; b=jvd36QzqivJwEOcgpLNF+Wyea0GCX+kvoQliBKYlYQUB1AoYT3GJPz+UcPYxYfpM73HNuKsS0jAoOMiseKrJ/FHDx/Df6bGhIZ2fkJY4Rs9Bp0Fzv6XLMcw6Diod6iS+tGax6uo9op7BZ1HPQ+UcsOBea3XrlLxti5P6T2aCc24= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612179012; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=u4qAZzuDouZl+gOMYX7Rt6s1o0IDup484vWy8CW96S4=; b=DWZix1c/voauvljXyaCueINXw4PePng2pn0PfjnW67jUvRmKzg2B4dlwZO4rAyyI31nK494PY/fgvA1u2a07EQub1+0qlZ4YJDSVa1mvZcmHtVmi9jEjWFq72O22Pco/345ql3xQ2MnIT554fgpptHIQefv3+D/yKa4jcb8cJGI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1612179012969715.6269838500051; Mon, 1 Feb 2021 03:30:12 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-253-gtcVV4EXPN6OmNWUoX01Mg-1; Mon, 01 Feb 2021 06:28:24 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0FAA51006C80; Mon, 1 Feb 2021 11:28:18 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 102622C169; Mon, 1 Feb 2021 11:28:16 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id C9CB5180954D; Mon, 1 Feb 2021 11:28:13 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 111BSCTr003249 for ; Mon, 1 Feb 2021 06:28:12 -0500 Received: by smtp.corp.redhat.com (Postfix) id 23D031840B; Mon, 1 Feb 2021 11:28:12 +0000 (UTC) Received: from work.redhat.com (ovpn-113-167.ams2.redhat.com [10.36.113.167]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3D5F7669F2; Mon, 1 Feb 2021 11:28:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612179011; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=u4qAZzuDouZl+gOMYX7Rt6s1o0IDup484vWy8CW96S4=; b=AYelCzroMsvlf92yh0dYXjBIeF0EfMtoObyUoc29IYsxXQPEU8KvqRriVTfFbiAFAyOy4J 3hpTtR1k72Ml7HC8hqJ9Gc9DUfc2q0xNhQMcOuMz3M/EVK0o8+x6S48n4jMrHPMgMSb/N9 mtI4PmkR2TRJjSvQ3368PfcVpmLGoI8= X-MC-Unique: gtcVV4EXPN6OmNWUoX01Mg-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH v2 02/20] commandhelper: Remove numpollfds variable Date: Mon, 1 Feb 2021 12:27:46 +0100 Message-Id: <20210201112804.144366-3-twiederh@redhat.com> In-Reply-To: <20210201112804.144366-1-twiederh@redhat.com> References: <20210201112804.144366-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: Peter Krempa , Tim Wiederhake X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Tim Wiederhake Reviewed-by: Peter Krempa --- tests/commandhelper.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/tests/commandhelper.c b/tests/commandhelper.c index c2040b76f0..2b937979c0 100644 --- a/tests/commandhelper.c +++ b/tests/commandhelper.c @@ -67,7 +67,6 @@ int main(int argc, char **argv) { int readfds[3] =3D { STDIN_FILENO, }; int numreadfds =3D 1; struct pollfd fds[3]; - int numpollfds =3D 0; char *buffers[3] =3D {NULL, NULL, NULL}; size_t buflen[3] =3D {0, 0, 0}; char c; @@ -167,21 +166,20 @@ int main(int argc, char **argv) { fflush(stderr); =20 for (i =3D 0; i < numreadfds; i++) { - fds[numpollfds].fd =3D readfds[i]; - fds[numpollfds].events =3D POLLIN; - fds[numpollfds].revents =3D 0; - numpollfds++; + fds[i].fd =3D readfds[i]; + fds[i].events =3D POLLIN; + fds[i].revents =3D 0; } =20 for (;;) { unsigned ctr =3D 0; =20 - if (poll(fds, numpollfds, -1) < 0) { + if (poll(fds, numreadfds, -1) < 0) { printf("poll failed: %s\n", strerror(errno)); goto cleanup; } =20 - for (i =3D 0; i < numpollfds; i++) { + for (i =3D 0; i < numreadfds; i++) { short revents =3D POLLIN | POLLHUP | POLLERR; =20 # ifdef __APPLE__ @@ -212,7 +210,7 @@ int main(int argc, char **argv) { } } } - for (i =3D 0; i < numpollfds; i++) { + for (i =3D 0; i < numreadfds; i++) { if (fds[i].events) { ctr++; break; @@ -222,7 +220,7 @@ int main(int argc, char **argv) { break; } =20 - for (i =3D 0; i < numpollfds; i++) { + for (i =3D 0; i < numreadfds; i++) { if (fwrite(buffers[i], 1, buflen[i], stdout) !=3D buflen[i]) goto cleanup; if (fwrite(buffers[i], 1, buflen[i], stderr) !=3D buflen[i]) --=20 2.26.2