[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-stable] [PATCH 047/113] qemu-pr-helper: Actually allow users to sp
From: |
Michael Roth |
Subject: |
[Qemu-stable] [PATCH 047/113] qemu-pr-helper: Actually allow users to specify pidfile |
Date: |
Mon, 18 Jun 2018 20:42:13 -0500 |
From: Michal Privoznik <address@hidden>
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 <address@hidden>
Message-Id: <address@hidden>
Cc: address@hidden
Reviewed-by: Eric Blake <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
(cherry picked from commit f8e1a989644f22ba2f7afb0e13b6ce2309ea9503)
Signed-off-by: Michael Roth <address@hidden>
---
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)
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.11.0
- [Qemu-stable] [PATCH 039/113] multiboot: fprintf(stderr...) -> error_report(), (continued)
- [Qemu-stable] [PATCH 039/113] multiboot: fprintf(stderr...) -> error_report(), Michael Roth, 2018/06/18
- [Qemu-stable] [PATCH 038/113] multiboot: Use header names when displaying fields, Michael Roth, 2018/06/18
- [Qemu-stable] [PATCH 040/113] multiboot: Reject kernels exceeding the address space, Michael Roth, 2018/06/18
- [Qemu-stable] [PATCH 003/113] virtio-balloon: unref the memory region before continuing, Michael Roth, 2018/06/18
- [Qemu-stable] [PATCH 041/113] multiboot: Check validity of mh_header_addr, Michael Roth, 2018/06/18
- [Qemu-stable] [PATCH 043/113] tests/multiboot: Add tests for the a.out kludge, Michael Roth, 2018/06/18
- [Qemu-stable] [PATCH 044/113] tests/multiboot: Add .gitignore, Michael Roth, 2018/06/18
- [Qemu-stable] [PATCH 042/113] tests/multiboot: Test exit code for every qemu run, Michael Roth, 2018/06/18
- [Qemu-stable] [PATCH 045/113] arm/translate-a64: treat DISAS_UPDATE as variant of DISAS_EXIT, Michael Roth, 2018/06/18
- [Qemu-stable] [PATCH 046/113] virtio_net: flush uncompleted TX on reset, Michael Roth, 2018/06/18
- [Qemu-stable] [PATCH 047/113] qemu-pr-helper: Actually allow users to specify pidfile,
Michael Roth <=
- [Qemu-stable] [PATCH 049/113] iotests: Test preallocated truncate of 2G image, Michael Roth, 2018/06/18
- [Qemu-stable] [PATCH 048/113] block/file-posix: Fix fully preallocated truncate, Michael Roth, 2018/06/18
- [Qemu-stable] [PATCH 050/113] tcg: Mark muluh_i64 and mulsh_i64 as 64-bit ops, Michael Roth, 2018/06/18
- [Qemu-stable] [PATCH 004/113] memfd: fix configure test, Michael Roth, 2018/06/18
- [Qemu-stable] [PATCH 051/113] target/i386: Fix andn instruction, Michael Roth, 2018/06/18
- [Qemu-stable] [PATCH 052/113] exec: fix memory leak in find_max_supported_pagesize(), Michael Roth, 2018/06/18
- [Qemu-stable] [PATCH 053/113] gluster: Fix blockdev-add with server.N.type=unix, Michael Roth, 2018/06/18
- [Qemu-stable] [PATCH 054/113] cpus.c: ensure running CPU recalculates icount deadlines on timer expiry, Michael Roth, 2018/06/18
- [Qemu-stable] [PATCH 056/113] hw/block/pflash_cfi: fix off-by-one error, Michael Roth, 2018/06/18
- [Qemu-stable] [PATCH 055/113] vfio-ccw: fix memory leaks in vfio_ccw_realize(), Michael Roth, 2018/06/18