From nobody Fri Dec 19 07:50:01 2025 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=1608304202; cv=none; d=zohomail.com; s=zohoarc; b=ArG4satmKPiCNlUfZwUZOEeYnnFf3PWMZkhm4mK+0pzqRN7lmHn5xs1t11ctn3I1eSqJF8H6seXW1SxPOKWQxwEi3QmMHDqLuZVCaaY2Vv1FkaSxsqJkKpfkX23FKUQpmPiuH1jYLcnW01PLHV/TmLQcyIL5bjGqR2KkBNZgmUE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608304202; h=Content-Type:Content-Transfer-Encoding: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=XsOQuBNYn8xEBbVfaOMuiBMquBEhUc7HD90tAW7bM2s=; b=EJE5LT3SS/Q/fkeyQ/tpRdTjWixm3QuMgXkeOCYlFyXk9orP3veMzv5jsLC+mIWxJxD+17wgk8doP7Rtx1be4NCLBr1Phe6q0vxSlJr8JJ4JSX9F0JhiXwUwo2LYsfowqkUjNeNboTPzy4ZS8YCJ+T8tolZLTFpCtI3f1dX38gY= 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 1608304202638621.4978248326635; Fri, 18 Dec 2020 07:10:02 -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-168-AfMV0vgmOOajCIeDXGRc9w-1; Fri, 18 Dec 2020 10:09:55 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 12512800D55; Fri, 18 Dec 2020 15:09:49 +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 E2E9560C15; Fri, 18 Dec 2020 15:09:48 +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 AFE7E1809CA7; Fri, 18 Dec 2020 15:09:48 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0BIF9OoQ014032 for ; Fri, 18 Dec 2020 10:09:24 -0500 Received: by smtp.corp.redhat.com (Postfix) id BF11E100AE2D; Fri, 18 Dec 2020 15:09:24 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.193.214]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1FD53100AE2C for ; Fri, 18 Dec 2020 15:09:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1608304198; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=XsOQuBNYn8xEBbVfaOMuiBMquBEhUc7HD90tAW7bM2s=; b=dmNB4vXDBuya8NvU3RIA+sqQgg5teLteZqXyCwYIfEvlHTmvOloRLA/mkQxHohUyIO8Hnf EIHDKSvFXu3gk4d2mTfK5whgYxB5z5Lzqq+yanyznF04I/cxOhK9+/kgebXq9xPXQi36nj o7SyAWtCgCH6JWij3h4kMikcQleaE9g= X-MC-Unique: AfMV0vgmOOajCIeDXGRc9w-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 02/10] leaseshelper: Report errors on failure Date: Fri, 18 Dec 2020 16:09:08 +0100 Message-Id: <7a24f9a194f69b6815eaa7c06385aab62ed23d05.1608303776.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com 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.12 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" If leasehelper fails all that we are left with is a simple error message produced by dnsmasq: lease-init script returned exit code 1 This is because the leasehelper did not write any message to stderr. According to dnsmasq's manpage, whenever it's invoking leasehelper the stderr is kept open: All file descriptors are closed except stdin, which is open to /dev/null, and stdout and stderr which capture output for logging by dnsmasq. As debugging leasehelper is not trivial (because dnsmasq invokes it with plenty of env vars set - that's how data is passed onto helper), let's print an error into stderr if exiting with an error. And since we are not calling public APIs, we have to call virDispatchError() explicitly and since we don't have any connection open, we have to pass NULL. Signed-off-by: Michal Privoznik --- src/network/leaseshelper.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/network/leaseshelper.c b/src/network/leaseshelper.c index 732dd09610..c20e63efa9 100644 --- a/src/network/leaseshelper.c +++ b/src/network/leaseshelper.c @@ -253,6 +253,8 @@ main(int argc, char **argv) rv =3D EXIT_SUCCESS; =20 cleanup: + if (rv !=3D EXIT_SUCCESS) + virDispatchError(NULL); if (pid_file_fd !=3D -1) virPidFileReleasePath(pid_file, pid_file_fd); =20 --=20 2.26.2