aboutsummaryrefslogtreecommitdiff
path: root/qemu-io-cmds.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2017-04-03 16:43:39 +0100
committerPeter Maydell <peter.maydell@linaro.org>2017-04-03 16:43:39 +0100
commitb1a419ec79c2451fd7b6acfb415a02881ad77844 (patch)
treee103c4b121c6b1d25c3b60cacb55ac3c2783697d /qemu-io-cmds.c
parent102a3d847891f48c0b13cace19d189217b05a725 (diff)
parent86d1bd70987cd11d85d01f52aa5824c63d910471 (diff)
downloadqemu-b1a419ec79c2451fd7b6acfb415a02881ad77844.zip
qemu-b1a419ec79c2451fd7b6acfb415a02881ad77844.tar.gz
qemu-b1a419ec79c2451fd7b6acfb415a02881ad77844.tar.bz2
Merge remote-tracking branch 'remotes/maxreitz/tags/pull-block-2017-04-03' into staging
Block patches for 2.9-rc3 # gpg: Signature made Mon 03 Apr 2017 16:29:49 BST # gpg: using RSA key 0xF407DB0061D5CF40 # gpg: Good signature from "Max Reitz <mreitz@redhat.com>" # Primary key fingerprint: 91BE B60A 30DB 3E88 57D1 1829 F407 DB00 61D5 CF40 * remotes/maxreitz/tags/pull-block-2017-04-03: block/parallels: Avoid overflows iotests: Improve image-clear tests on non-aligned image qcow2: Discard unaligned tail when wiping image iotests: fix 097 when run with qcow qemu-io-cmds: Assert that global and nofile commands don't use ct->perms sheepdog: Fix blockdev-add nbd: Tidy up blockdev-add interface sockets: New helper socket_address_crumple() qapi-schema: SocketAddressFlat variants 'vsock' and 'fd' gluster: Prepare for SocketAddressFlat extension block: Document -drive problematic code and bugs io vnc sockets: Clean up SocketAddressKind switches char: Fix socket with "type": "vsock" address nbd sockets vnc: Mark problematic address family tests TODO block: add missed aio_context_acquire into release_drive Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'qemu-io-cmds.c')
-rw-r--r--qemu-io-cmds.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/qemu-io-cmds.c b/qemu-io-cmds.c
index 2c48f9c..883f53b 100644
--- a/qemu-io-cmds.c
+++ b/qemu-io-cmds.c
@@ -35,6 +35,13 @@ static int compare_cmdname(const void *a, const void *b)
void qemuio_add_command(const cmdinfo_t *ci)
{
+ /* ci->perm assumes a file is open, but the GLOBAL and NOFILE_OK
+ * flags allow it not to be, so that combination is invalid.
+ * Catch it now rather than letting it manifest as a crash if a
+ * particular set of command line options are used.
+ */
+ assert(ci->perm == 0 ||
+ (ci->flags & (CMD_FLAG_GLOBAL | CMD_NOFILE_OK)) == 0);
cmdtab = g_renew(cmdinfo_t, cmdtab, ++ncmds);
cmdtab[ncmds - 1] = *ci;
qsort(cmdtab, ncmds, sizeof(*cmdtab), compare_cmdname);