|
@@ -1,4 +1,4 @@
|
|
|
-// Copyright (C) 2013 Internet Systems Consortium, Inc. ("ISC")
|
|
|
+// Copyright (C) 2013, 2015 Internet Systems Consortium, Inc. ("ISC")
|
|
|
//
|
|
|
// Permission to use, copy, modify, and/or distribute this software for any
|
|
|
// purpose with or without fee is hereby granted, provided that the above
|
|
@@ -32,6 +32,14 @@ PktFilter::openFallbackSocket(const isc::asiolink::IOAddress& addr,
|
|
|
" address " << addr << ", port " << port
|
|
|
<< ", reason: " << strerror(errno));
|
|
|
}
|
|
|
+ // Set the close-on-exec flag.
|
|
|
+ if (fcntl(sock, F_SETFD, FD_CLOEXEC) < 0) {
|
|
|
+ close(sock);
|
|
|
+ isc_throw(SocketConfigError, "Failed to set close-on-exec flag"
|
|
|
+ << " on fallback socket for address " << addr
|
|
|
+ << ", port " << port
|
|
|
+ << ", reason: " << strerror(errno));
|
|
|
+ }
|
|
|
// Bind the socket to a specified address and port.
|
|
|
struct sockaddr_in addr4;
|
|
|
memset(&addr4, 0, sizeof(addr4));
|