提交 3b9243e0 编写于 作者: D Daniel P. Berrange 提交者: Eric Blake

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: NDaniel P. Berrange <berrange@redhat.com>
(cherry picked from commit d6670a64)
上级 fa8692cd
......@@ -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) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册