diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2018-07-17 14:31:45 +0200 |
---|---|---|
committer | Marc-André Lureau <marcandre.lureau@redhat.com> | 2018-11-01 12:12:09 +0400 |
commit | 4591bd46e6f8db67b61fdf09ae1bc266d73808ee (patch) | |
tree | f6822f5936428d58db12a0677dc50f15e7a42b8f | |
parent | 3b023756b1807f4d5f91a5c2c801935c45fa9bed (diff) |
char-socket: make 'fd' incompatible with 'reconnect'
A chardev socket created with the 'fd=' argument is not going to
handle reconnection properly by recycling the same fd (or not in a
supported way). Let's forbid this case.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
-rw-r--r-- | chardev/char-socket.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/chardev/char-socket.c b/chardev/char-socket.c index 64e24cb2ab..e4137ccd3c 100644 --- a/chardev/char-socket.c +++ b/chardev/char-socket.c @@ -997,6 +997,10 @@ static void qmp_chardev_open_socket(Chardev *chr, s->addr = addr = socket_address_flatten(sock->addr); + if (sock->has_reconnect && addr->type == SOCKET_ADDRESS_TYPE_FD) { + error_setg(errp, "'reconnect' option is incompatible with 'fd'"); + goto error; + } qemu_chr_set_feature(chr, QEMU_CHAR_FEATURE_RECONNECTABLE); /* TODO SOCKET_ADDRESS_FD where fd has AF_UNIX */ if (addr->type == SOCKET_ADDRESS_TYPE_UNIX) { |