From nobody Mon Feb 9 23:01:06 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 152937489125688.50747273966726; Mon, 18 Jun 2018 19:21:31 -0700 (PDT) Received: from localhost ([::1]:38583 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fV6Gt-0003Yq-1S for importer@patchew.org; Mon, 18 Jun 2018 22:21:27 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46195) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fV5iQ-00022G-HP for qemu-devel@nongnu.org; Mon, 18 Jun 2018 21:45:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fV5iP-000091-If for qemu-devel@nongnu.org; Mon, 18 Jun 2018 21:45:50 -0400 Received: from mail-ot0-x22d.google.com ([2607:f8b0:4003:c0f::22d]:43000) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fV5iP-00008s-E3; Mon, 18 Jun 2018 21:45:49 -0400 Received: by mail-ot0-x22d.google.com with SMTP id 92-v6so20760342otw.9; Mon, 18 Jun 2018 18:45:49 -0700 (PDT) Received: from localhost ([2600:1700:70:e488:b0ee:9bda:ee6f:91be]) by smtp.gmail.com with ESMTPSA id 4-v6sm6844956oil.2.2018.06.18.18.45.46 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Jun 2018 18:45:47 -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=A8twTIhqZmhEdHqqnjYH9nVhDzWUFyDBtAnvCAHtguE=; b=QXQGimicG7A/qC6bcAuvmAXirQ7ZleWKLinFHv/6MJi1MrO28/Ad5b4qnnoUdyBbDS KpHll4wkGN2DERjCQjRksj7MNlMKuYkG97uGfZZEnO20h38OKmHanvqlzv/HwJgPS7oe Z5DuxqsgPLCISud7AR8IdkXhjUEUr/H58PagDcqBxe0rIn0303bpXO4g6ilGIBIpyiGQ TWX7/MUohQZPFeP9JmsNv/ClY1crH82MRiV8k+eXJ15mu3XCm7wwYv1jpdFITuW4iRPj L7nFPDtN6+Vukv0JhM8VI1FPsNnHlrivxsUzlmRN4RakUUmj3ZSNuP8JJ1CsdrwRqy5u PQUA== 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=A8twTIhqZmhEdHqqnjYH9nVhDzWUFyDBtAnvCAHtguE=; b=WKHVq8mu++j3YNrPhb501d9He+Z4zvnQfs8W7TmmvnLewjOq9CZw53rN485zDbO0M9 EmiYaJojKZw6KD+0GaZ63cdpXzxH6TTD/KRP4nYQW3k6r7OsaKlu8drXSCrL2vfryDxr vEayTTMQSb7c3X+gqe6PyxQoimBbuB18oUNotYaK+fbohyWmhkgPEZXfXtSSeoG8AdJs ot5aFnsXgB8UQRVDXpzlfs7hAjBRNmjpZpD1/a1aYvtLiKGjqzug+mRilRpumL931n6r mScy2ihZSK542GuT/W5s3qkb3p1v1f1nomDBpRx26UFvWaVMVeJJMFYoOLLqxGaq8QGs BAnw== X-Gm-Message-State: APt69E08C0Zjc6CzFmf0siNnA87TNXk50t0SeRm3RqrPfUZv193Z5wSv 10/y6DdJBEEFoh0wKFthvhK9FZsK X-Google-Smtp-Source: ADUXVKIjsHhsLCPAgpItqa6H5XFyY4liY6EjFmcIpin5FPWpGAynFUTlXrk7lvsZtMqsC4wAz+LNsQ== X-Received: by 2002:a9d:338d:: with SMTP id u13-v6mr9579238otc.232.1529372748193; Mon, 18 Jun 2018 18:45:48 -0700 (PDT) From: Michael Roth To: qemu-devel@nongnu.org Date: Mon, 18 Jun 2018 20:42:13 -0500 Message-Id: <20180619014319.28272-48-mdroth@linux.vnet.ibm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180619014319.28272-1-mdroth@linux.vnet.ibm.com> References: <20180619014319.28272-1-mdroth@linux.vnet.ibm.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4003:c0f::22d Subject: [Qemu-devel] [PATCH 047/113] 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, Paolo Bonzini 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 (cherry picked from commit f8e1a989644f22ba2f7afb0e13b6ce2309ea9503) Signed-off-by: Michael Roth --- 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 9fe615c73c..12474d162c 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 2.11.0