diff options
Diffstat (limited to 'util/qemu-sockets.c')
-rw-r--r-- | util/qemu-sockets.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c index c415c342c1..080a240b74 100644 --- a/util/qemu-sockets.c +++ b/util/qemu-sockets.c @@ -1164,6 +1164,25 @@ static int socket_get_fd(const char *fdstr, Error **errp) return fd; } +int socket_address_parse_named_fd(SocketAddress *addr, Error **errp) +{ + int fd; + + if (addr->type != SOCKET_ADDRESS_TYPE_FD) { + return 0; + } + + fd = socket_get_fd(addr->u.fd.str, errp); + if (fd < 0) { + return fd; + } + + g_free(addr->u.fd.str); + addr->u.fd.str = g_strdup_printf("%d", fd); + + return 0; +} + int socket_connect(SocketAddress *addr, Error **errp) { int fd; |