summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
ee412cb)
Since we no longer use closefds(), start cleaning up stray descriptors.
Start by making sure that any network sockets we create have the
close-on-exec flag set on them.
#include "client.h"
#include "h/mts.h"
#include "h/utils.h"
#include "client.h"
#include "h/mts.h"
#include "h/utils.h"
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
}
if (connect(sd, ai->ai_addr, ai->ai_addrlen) == 0) {
}
if (connect(sd, ai->ai_addr, ai->ai_addrlen) == 0) {
+
+ flags = fcntl(sd, F_GETFD, 0);
+
+ if (flags != -1)
+ fcntl(sd, F_SETFD, flags | FD_CLOEXEC);
+