mirror of https://github.com/xqemu/xqemu.git
qemu-pr-helper: Actually allow users to specify pidfile
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> Message-Id: <6f10cd53d361a395aa0e85a9311ec4e9a8fc11e5.1521868451.git.mprivozn@redhat.com> Cc: qemu-stable@nongnu.org Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
12051d82f0
commit
f8e1a98964
|
@ -903,12 +903,12 @@ static int drop_privileges(void)
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
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[] = {
|
struct option lopt[] = {
|
||||||
{ "help", no_argument, NULL, 'h' },
|
{ "help", no_argument, NULL, 'h' },
|
||||||
{ "version", no_argument, NULL, 'V' },
|
{ "version", no_argument, NULL, 'V' },
|
||||||
{ "socket", required_argument, NULL, 'k' },
|
{ "socket", required_argument, NULL, 'k' },
|
||||||
{ "pidfile", no_argument, NULL, 'f' },
|
{ "pidfile", required_argument, NULL, 'f' },
|
||||||
{ "daemon", no_argument, NULL, 'd' },
|
{ "daemon", no_argument, NULL, 'd' },
|
||||||
{ "trace", required_argument, NULL, 'T' },
|
{ "trace", required_argument, NULL, 'T' },
|
||||||
{ "user", required_argument, NULL, 'u' },
|
{ "user", required_argument, NULL, 'u' },
|
||||||
|
@ -952,7 +952,8 @@ int main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'f':
|
case 'f':
|
||||||
pidfile = optarg;
|
g_free(pidfile);
|
||||||
|
pidfile = g_strdup(optarg);
|
||||||
break;
|
break;
|
||||||
#ifdef CONFIG_LIBCAP
|
#ifdef CONFIG_LIBCAP
|
||||||
case 'u': {
|
case 'u': {
|
||||||
|
|
Loading…
Reference in New Issue