sockets: check that the named file descriptor is a socket
commit30bdb3c56ddd911ab2b1629faa4ce6e883b80e2a
authorDaniel P. Berrange <berrange@redhat.com>
Fri, 22 Dec 2017 11:08:49 +0000 (22 11:08 +0000)
committerDaniel P. Berrangé <berrange@redhat.com>
Tue, 13 Mar 2018 18:06:06 +0000 (13 18:06 +0000)
tree1d16d017837d0f101626771ca2c1c47180c78cce
parent58dc31f1a7dc6cd0f21bd51a34011ba366d36e53
sockets: check that the named file descriptor is a socket

The SocketAddress struct has an "fd" type, which references the name of a
file descriptor passed over the monitor using the "getfd" command. We
currently blindly assume the FD is a socket, which can lead to hard to
diagnose errors later. This adds an explicit check that the FD is actually
a socket to improve the error diagnosis.

Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
tests/test-util-sockets.c
util/qemu-sockets.c