Commit 8f5187d1 authored by Michal 'vorner' Vaner's avatar Michal 'vorner' Vaner
Browse files

Merge #1705

parents 464cada6 6ca1f0da
......@@ -20,6 +20,7 @@
#include <sys/uio.h>
#include <errno.h>
#include <stdlib.h> // for malloc and free
#include <unistd.h>
#include "fd_share.h"
namespace isc {
......@@ -106,7 +107,12 @@ recv_fd(const int sock) {
std::memcpy(&fd, CMSG_DATA(cmsg), sizeof(int));
}
free(msghdr.msg_control);
return (fd);
// It is strange, but the call can return the same file descriptor as
// one returned previously, even if that one is not closed yet. So,
// we just re-number every one we get, so they are unique.
int new_fd(dup(fd));
close(fd);
return (new_fd);
}
int
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment