]> git.proxmox.com Git - mirror_qemu.git/commit - qemu-nbd.c
qemu-nbd: Fail earlier for -c/-d on non-linux
authorEric Blake <eblake@redhat.com>
Sat, 15 Dec 2018 13:53:08 +0000 (07:53 -0600)
committerEric Blake <eblake@redhat.com>
Sat, 5 Jan 2019 13:50:22 +0000 (07:50 -0600)
commit3c1fa35d74aabe9c3ab642d2591b087e53d7a616
treed8225f4f4749c94717dbf84457744100440a52f4
parent6c5c035138218a384a229e7b6b9cf51451621c6a
qemu-nbd: Fail earlier for -c/-d on non-linux

Connecting to a /dev/nbdN device is a Linux-specific action.
We were already masking -c and -d from 'qemu-nbd --help' on
non-linux.  However, while -d fails with a sensible error
message, it took hunting through a couple of files to prove
that.  What's more, the code for -c doesn't fail until after
it has created a pthread and tried to open a device - possibly
even printing an error message with %m on a non-Linux platform
in spite of the comment that %m is glibc-specific.  Make the
failure happen sooner, then get rid of stubs that are no
longer needed because of the early exits.

While at it: tweak the blank newlines in --help output to be
consistent, whether or not built on Linux.

Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <20181215135324.152629-7-eblake@redhat.com>
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
nbd/client.c
qemu-nbd.c