diff options
author | Anthony Liguori <aliguori@us.ibm.com> | 2013-04-02 14:07:35 -0500 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2013-04-02 14:07:35 -0500 |
commit | 162cbbd1736de2bca43fdefa7e98c54a361ee60d (patch) | |
tree | b61fbd71c097e8f6447a785132fb12f973e73e24 /net/socket.c | |
parent | 9d4563c415683e4d06c84a46e8d178a680fdcb7b (diff) | |
parent | 9b938c7262e403f5467110609cb20ef1ae6e9df2 (diff) | |
download | hqemu-162cbbd1736de2bca43fdefa7e98c54a361ee60d.zip hqemu-162cbbd1736de2bca43fdefa7e98c54a361ee60d.tar.gz |
Merge remote-tracking branch 'luiz/queue/qmp' into staging
# By Stefan Hajnoczi
# Via Luiz Capitulino
* luiz/queue/qmp:
chardev: clear O_NONBLOCK on SCM_RIGHTS file descriptors
qemu-socket: set passed fd non-blocking in socket_connect()
net: ensure "socket" backend uses non-blocking fds
oslib-posix: rename socket_set_nonblock() to qemu_set_nonblock()
Diffstat (limited to 'net/socket.c')
-rw-r--r-- | net/socket.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/net/socket.c b/net/socket.c index 6c3752b..87af1d3 100644 --- a/net/socket.c +++ b/net/socket.c @@ -308,7 +308,7 @@ static int net_socket_mcast_create(struct sockaddr_in *mcastaddr, struct in_addr } } - socket_set_nonblock(fd); + qemu_set_nonblock(fd); return fd; fail: if (fd >= 0) @@ -519,7 +519,7 @@ static int net_socket_listen_init(NetClientState *peer, perror("socket"); return -1; } - socket_set_nonblock(fd); + qemu_set_nonblock(fd); /* allow fast reuse */ val = 1; @@ -565,7 +565,7 @@ static int net_socket_connect_init(NetClientState *peer, perror("socket"); return -1; } - socket_set_nonblock(fd); + qemu_set_nonblock(fd); connected = 0; for(;;) { @@ -674,6 +674,7 @@ static int net_socket_udp_init(NetClientState *peer, closesocket(fd); return -1; } + qemu_set_nonblock(fd); s = net_socket_fd_init(peer, model, name, fd, 0); if (!s) { @@ -712,7 +713,11 @@ int net_init_socket(const NetClientOptions *opts, const char *name, int fd; fd = monitor_handle_fd_param(cur_mon, sock->fd); - if (fd == -1 || !net_socket_fd_init(peer, "socket", name, fd, 1)) { + if (fd == -1) { + return -1; + } + qemu_set_nonblock(fd); + if (!net_socket_fd_init(peer, "socket", name, fd, 1)) { return -1; } return 0; |