diff options
author | Kevin Wolf <kwolf@redhat.com> | 2009-12-02 12:24:42 +0100 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2009-12-03 11:45:50 -0600 |
commit | 40ff6d7e8dceca227e7f8a3e8e0d58b2c66d19b4 (patch) | |
tree | 98d560a0de229f27a66f637cfcadbb1672e68cc3 /migration-tcp.c | |
parent | 12c09b8ce22d74f78ff50f95676cbe4f501752ae (diff) | |
download | qemu-40ff6d7e8dceca227e7f8a3e8e0d58b2c66d19b4.zip qemu-40ff6d7e8dceca227e7f8a3e8e0d58b2c66d19b4.tar.gz qemu-40ff6d7e8dceca227e7f8a3e8e0d58b2c66d19b4.tar.bz2 |
Don't leak file descriptors
We're leaking file descriptors to child processes. Set FD_CLOEXEC on file
descriptors that don't need to be passed to children to stop this misbehaviour.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'migration-tcp.c')
-rw-r--r-- | migration-tcp.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/migration-tcp.c b/migration-tcp.c index b77ed87..2cfa8cb 100644 --- a/migration-tcp.c +++ b/migration-tcp.c @@ -105,7 +105,7 @@ MigrationState *tcp_start_outgoing_migration(Monitor *mon, s->state = MIG_STATE_ACTIVE; s->mon = NULL; s->bandwidth_limit = bandwidth_limit; - s->fd = socket(PF_INET, SOCK_STREAM, 0); + s->fd = qemu_socket(PF_INET, SOCK_STREAM, 0); if (s->fd == -1) { qemu_free(s); return NULL; @@ -146,7 +146,7 @@ static void tcp_accept_incoming_migration(void *opaque) int c, ret; do { - c = accept(s, (struct sockaddr *)&addr, &addrlen); + c = qemu_accept(s, (struct sockaddr *)&addr, &addrlen); } while (c == -1 && socket_error() == EINTR); dprintf("accepted migration\n"); @@ -193,7 +193,7 @@ int tcp_start_incoming_migration(const char *host_port) return -EINVAL; } - s = socket(PF_INET, SOCK_STREAM, 0); + s = qemu_socket(PF_INET, SOCK_STREAM, 0); if (s == -1) return -socket_error(); |