From nobody Mon Feb 9 16:53:53 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1522071930618831.7761392286517; Mon, 26 Mar 2018 06:45:30 -0700 (PDT) Received: from localhost ([::1]:56839 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0SRF-0005p5-JI for importer@patchew.org; Mon, 26 Mar 2018 09:45:29 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57304) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0SJD-0006kx-2a for qemu-devel@nongnu.org; Mon, 26 Mar 2018 09:37:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f0SJ8-00073c-Uu for qemu-devel@nongnu.org; Mon, 26 Mar 2018 09:37:11 -0400 Received: from mail-wr0-x241.google.com ([2a00:1450:400c:c0c::241]:38089) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f0SJ8-00073B-Oz; Mon, 26 Mar 2018 09:37:06 -0400 Received: by mail-wr0-x241.google.com with SMTP id m13so5632368wrj.5; Mon, 26 Mar 2018 06:37:06 -0700 (PDT) Received: from 640k.lan (94-36-194-48.adsl-ull.clienti.tiscali.it. [94.36.194.48]) by smtp.gmail.com with ESMTPSA id g186sm6710105wmd.41.2018.03.26.06.37.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Mar 2018 06:37:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=87W+1XV4WhTBQljBRjW3lG2KJXw2mmtgXGjXv0rTyp4=; b=euh/+0d+RZyI0S6gAEwwZsUHBfbsoFalAYqXfm+GLqYgyT3yO69dMqh8ioQ93B9eSa 58RUL8O5GRJ/RnZdGpQJ2xndpYuMbBO2v+VcVNpMYRqTk4viC9b5bCZRxJtpVxDtNYhU UVhQpZHYqmq2QWrmAbMiT7UXt/zBwODlQd8OASZPKjLLWdyIsD5YiJ1E1isK3SE45Jt3 7cpai+YFm5NZ1CPKeHox9CQL/Erht7VniDTCYdH3qtzKLbwdrIJcW1PMFFexurrKWJdh rGjrIhbJVkqkgZaRdE7Y00GG4ElaFR1sikDFWjoF7+15dwIivFDgRrFhamw+uuBdEoyM Y64A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=87W+1XV4WhTBQljBRjW3lG2KJXw2mmtgXGjXv0rTyp4=; b=rQSd9i/0VxWLxHKpq8fm25I8U2g7eSLPEoI8gjbZ86Hfsd97m4qkfyFW4j3+4bbJpy xNqW4LQuoENHmj7hdFSQIysSapBLgLkUJqi6/Ujd5yQ7b5GBV1ThRuQ6Q5SW2sJJMKlF XDTv9DkuYRkAgg1HR7rkA4v/bOAXenB/7LrIU9PGeL/wa1Cm1wX8oNxHixu5tahbxDmX Upw5Vi5dk/IB9drYQMJx3vgTg1M20brll3louiJBNgdEAXaaxaWys6jFA2yanobQL7Wo FIDvzGKYxmTnzNN9TyFsJVmUJEOhz4tbl5m9aDSjgx1XEIC+KUqwhMlv2EkpVYhNRxXU UAXA== X-Gm-Message-State: AElRT7E20WK2zzUcuSyOGXGGza1WMs09JzCgMijKMGEzAiylL78eQsYb OpNw/4wAGX2NbhErhiNH5DqFxu4p X-Google-Smtp-Source: AG47ELub2kIl12vcwuPE0y7zdScPnrkn9vRM3Kg5HRSrRP1pT5IMNqr2BDGkcxi+dV9RjQcrUDjyBw== X-Received: by 10.223.153.177 with SMTP id y46mr29872950wrb.215.1522071425361; Mon, 26 Mar 2018 06:37:05 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Mon, 26 Mar 2018 15:36:43 +0200 Message-Id: <1522071403-52486-17-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1522071403-52486-1-git-send-email-pbonzini@redhat.com> References: <1522071403-52486-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::241 Subject: [Qemu-devel] [PULL 16/16] qemu-pr-helper: Actually allow users to specify pidfile X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michal Privoznik , qemu-stable@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Michal Privoznik Due to wrong specification of arguments to getopt_long() any attempt to set pidfile resulted in: 1) the default to be leaked 2) the @pidfile variable to be set to NULL (because optarg is NULL without this patch). Signed-off-by: Michal Privoznik Message-Id: <6f10cd53d361a395aa0e85a9311ec4e9a8fc11e5.1521868451.git.mprivo= zn@redhat.com> Cc: qemu-stable@nongnu.org Reviewed-by: Eric Blake Signed-off-by: Paolo Bonzini --- scsi/qemu-pr-helper.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scsi/qemu-pr-helper.c b/scsi/qemu-pr-helper.c index 3facbba..21e1b8e 100644 --- a/scsi/qemu-pr-helper.c +++ b/scsi/qemu-pr-helper.c @@ -903,12 +903,12 @@ static int drop_privileges(void) =20 int main(int argc, char **argv) { - const char *sopt =3D "hVk:fdT:u:g:vq"; + const char *sopt =3D "hVk:f:dT:u:g:vq"; struct option lopt[] =3D { { "help", no_argument, NULL, 'h' }, { "version", no_argument, NULL, 'V' }, { "socket", required_argument, NULL, 'k' }, - { "pidfile", no_argument, NULL, 'f' }, + { "pidfile", required_argument, NULL, 'f' }, { "daemon", no_argument, NULL, 'd' }, { "trace", required_argument, NULL, 'T' }, { "user", required_argument, NULL, 'u' }, @@ -952,7 +952,8 @@ int main(int argc, char **argv) } break; case 'f': - pidfile =3D optarg; + g_free(pidfile); + pidfile =3D g_strdup(optarg); break; #ifdef CONFIG_LIBCAP case 'u': { --=20 1.8.3.1