* [Qemu-trivial] [PATCH] qemu-pr-helper: Actually allow users to specify pidfile
@ 2018-03-24 5:14 Michal Privoznik
2018-03-24 11:44 ` [Qemu-trivial] [Qemu-devel] " Eric Blake
2018-03-24 11:46 ` [Qemu-trivial] [Qemu-devel] [PATCH for-2.12] " Eric Blake
0 siblings, 2 replies; 4+ messages in thread
From: Michal Privoznik @ 2018-03-24 5:14 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-trivial, pbonzini, famz, qemu-block
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 <mprivozn@redhat.com>
---
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 3facbba170..21e1b8ea60 100644
--- a/scsi/qemu-pr-helper.c
+++ b/scsi/qemu-pr-helper.c
@@ -903,12 +903,12 @@ static int drop_privileges(void)
int main(int argc, char **argv)
{
- const char *sopt = "hVk:fdT:u:g:vq";
+ const char *sopt = "hVk:f:dT:u:g:vq";
struct option lopt[] = {
{ "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 = optarg;
+ g_free(pidfile);
+ pidfile = g_strdup(optarg);
break;
#ifdef CONFIG_LIBCAP
case 'u': {
--
2.16.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [Qemu-trivial] [Qemu-devel] [PATCH] qemu-pr-helper: Actually allow users to specify pidfile
2018-03-24 5:14 [Qemu-trivial] [PATCH] qemu-pr-helper: Actually allow users to specify pidfile Michal Privoznik
@ 2018-03-24 11:44 ` Eric Blake
2018-03-24 11:46 ` [Qemu-trivial] [Qemu-devel] [PATCH for-2.12] " Eric Blake
1 sibling, 0 replies; 4+ messages in thread
From: Eric Blake @ 2018-03-24 11:44 UTC (permalink / raw)
To: Michal Privoznik, qemu-devel
Cc: qemu-trivial, pbonzini, famz, qemu-block, qemu-stable
On 03/24/2018 12:14 AM, Michal Privoznik wrote:
> 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).
Broken in introduction with commit b855f8d, in 2.11.
>
> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
CC: qemu-stable@nongnu.org
Reviewed-by: Eric Blake <eblake@redhat.com>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-trivial] [Qemu-devel] [PATCH for-2.12] qemu-pr-helper: Actually allow users to specify pidfile
2018-03-24 5:14 [Qemu-trivial] [PATCH] qemu-pr-helper: Actually allow users to specify pidfile Michal Privoznik
2018-03-24 11:44 ` [Qemu-trivial] [Qemu-devel] " Eric Blake
@ 2018-03-24 11:46 ` Eric Blake
2018-03-26 11:10 ` Paolo Bonzini
1 sibling, 1 reply; 4+ messages in thread
From: Eric Blake @ 2018-03-24 11:46 UTC (permalink / raw)
To: Michal Privoznik, qemu-devel
Cc: qemu-trivial, pbonzini, famz, qemu-block, qemu-stable
On 03/24/2018 12:14 AM, Michal Privoznik wrote:
> 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).
Broken since the introduction in commit b855f8d, in 2.11 (documentation
has always mentioned the argument, code has never supported it).
>
> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
CC: qemu-stable@nongnu.org
Reviewed-by: Eric Blake <eblake@redhat.com>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-trivial] [Qemu-devel] [PATCH for-2.12] qemu-pr-helper: Actually allow users to specify pidfile
2018-03-24 11:46 ` [Qemu-trivial] [Qemu-devel] [PATCH for-2.12] " Eric Blake
@ 2018-03-26 11:10 ` Paolo Bonzini
0 siblings, 0 replies; 4+ messages in thread
From: Paolo Bonzini @ 2018-03-26 11:10 UTC (permalink / raw)
To: Eric Blake, Michal Privoznik, qemu-devel
Cc: qemu-trivial, famz, qemu-block, qemu-stable
On 24/03/2018 12:46, Eric Blake wrote:
> On 03/24/2018 12:14 AM, Michal Privoznik wrote:
>> 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).
>
> Broken since the introduction in commit b855f8d, in 2.11 (documentation
> has always mentioned the argument, code has never supported it).
Queued, thanks.
Paolo
>>
>> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
>
> CC: qemu-stable@nongnu.org
> Reviewed-by: Eric Blake <eblake@redhat.com>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-03-26 11:10 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-24 5:14 [Qemu-trivial] [PATCH] qemu-pr-helper: Actually allow users to specify pidfile Michal Privoznik
2018-03-24 11:44 ` [Qemu-trivial] [Qemu-devel] " Eric Blake
2018-03-24 11:46 ` [Qemu-trivial] [Qemu-devel] [PATCH for-2.12] " Eric Blake
2018-03-26 11:10 ` Paolo Bonzini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).