diff options
author | Kozlov Dmitry <xeb@mail.ru> | 2012-01-13 12:38:26 +0400 |
---|---|---|
committer | Kozlov Dmitry <xeb@mail.ru> | 2012-01-13 12:38:26 +0400 |
commit | bf1ccc7f6e7a9dc5a8ba3d8d02b25ad446458840 (patch) | |
tree | 4e53a7f2990e40436f6ae98434f72c3db14434c0 /accel-pppd/ctrl/l2tp/l2tp.c | |
parent | 03a466f1b0f7549c2ef89c1e544c2c86c3958ad4 (diff) | |
download | accel-ppp-bf1ccc7f6e7a9dc5a8ba3d8d02b25ad446458840.tar.gz accel-ppp-bf1ccc7f6e7a9dc5a8ba3d8d02b25ad446458840.zip |
set FD_CLOEXEC on opened file descriptors
Diffstat (limited to 'accel-pppd/ctrl/l2tp/l2tp.c')
-rw-r--r-- | accel-pppd/ctrl/l2tp/l2tp.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/accel-pppd/ctrl/l2tp/l2tp.c b/accel-pppd/ctrl/l2tp/l2tp.c index ea99b820..fd74c2e8 100644 --- a/accel-pppd/ctrl/l2tp/l2tp.c +++ b/accel-pppd/ctrl/l2tp/l2tp.c @@ -244,6 +244,8 @@ static int l2tp_tunnel_alloc(struct l2tp_serv_t *serv, struct l2tp_packet_t *pac mempool_free(conn); return -1; } + + fcntl(conn->hnd.fd, F_SETFD, fcntl(conn->hnd.fd, F_GETFD) | FD_CLOEXEC); memset(&addr, 0, sizeof(addr)); addr.sin_family = AF_INET; @@ -358,6 +360,8 @@ static int l2tp_connect(struct l2tp_conn_t *conn) log_ppp_error("l2tp: socket(AF_PPPOX): %s\n", strerror(errno)); return -1; } + + fcntl(conn->tunnel_fd, F_SETFD, fcntl(conn->tunnel_fd, F_GETFD) | FD_CLOEXEC); conn->ppp.fd = socket(AF_PPPOX, SOCK_DGRAM, PX_PROTO_OL2TP); if (!conn->ppp.fd) { @@ -366,6 +370,8 @@ static int l2tp_connect(struct l2tp_conn_t *conn) log_ppp_error("l2tp: socket(AF_PPPOX): %s\n", strerror(errno)); return -1; } + + fcntl(conn->ppp.fd, F_SETFD, fcntl(conn->ppp.fd, F_GETFD) | FD_CLOEXEC); if (connect(conn->tunnel_fd, (struct sockaddr *)&pppox_addr, sizeof(pppox_addr)) < 0) { log_ppp_error("l2tp: connect(tunnel): %s\n", strerror(errno)); @@ -1043,6 +1049,8 @@ static void start_udp_server(void) log_emerg("l2tp: socket: %s\n", strerror(errno)); return; } + + fcntl(udp_serv.hnd.fd, F_SETFD, fcntl(udp_serv.hnd.fd, F_GETFD) | FD_CLOEXEC); memset(&addr, 0, sizeof(addr)); addr.sin_family = AF_INET; |