mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-08 05:55:19 +00:00
Fix F_DUPFD_CLOEXEC operation args
The F_DUPFD_CLOEXEC operation with fcntl() expects a single
int argument, specifying the minimum FD number for the newly
dup'd file descriptor. We were not specifying that causing
random stack data to be accessed as the FD number. Sometimes
that worked, sometimes it didn't.
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
(cherry picked from commit d6670a64e1
)
This commit is contained in:
parent
fa8692cd2e
commit
3b9243e018
@ -1055,7 +1055,7 @@ int virNetSocketDupFD(virNetSocketPtr sock, bool cloexec)
|
||||
int fd;
|
||||
|
||||
if (cloexec)
|
||||
fd = fcntl(sock->fd, F_DUPFD_CLOEXEC);
|
||||
fd = fcntl(sock->fd, F_DUPFD_CLOEXEC, 0);
|
||||
else
|
||||
fd = dup(sock->fd);
|
||||
if (fd < 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user