mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 15:23:53 -06:00
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>
This commit is contained in:
parent
12c09b8ce2
commit
40ff6d7e8d
20 changed files with 178 additions and 34 deletions
|
@ -2356,6 +2356,9 @@ static void gdb_accept(void)
|
|||
perror("accept");
|
||||
return;
|
||||
} else if (fd >= 0) {
|
||||
#ifndef _WIN32
|
||||
fcntl(fd, F_SETFD, FD_CLOEXEC);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -2385,6 +2388,9 @@ static int gdbserver_open(int port)
|
|||
perror("socket");
|
||||
return -1;
|
||||
}
|
||||
#ifndef _WIN32
|
||||
fcntl(fd, F_SETFD, FD_CLOEXEC);
|
||||
#endif
|
||||
|
||||
/* allow fast reuse */
|
||||
val = 1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue