summaryrefslogtreecommitdiff
path: root/accel-pppd/ctrl/pptp
diff options
context:
space:
mode:
authorKozlov Dmitry <xeb@mail.ru>2012-01-13 12:38:26 +0400
committerKozlov Dmitry <xeb@mail.ru>2012-01-13 12:38:26 +0400
commitbf1ccc7f6e7a9dc5a8ba3d8d02b25ad446458840 (patch)
tree4e53a7f2990e40436f6ae98434f72c3db14434c0 /accel-pppd/ctrl/pptp
parent03a466f1b0f7549c2ef89c1e544c2c86c3958ad4 (diff)
downloadaccel-ppp-xebd-bf1ccc7f6e7a9dc5a8ba3d8d02b25ad446458840.tar.gz
accel-ppp-xebd-bf1ccc7f6e7a9dc5a8ba3d8d02b25ad446458840.zip
set FD_CLOEXEC on opened file descriptors
Diffstat (limited to 'accel-pppd/ctrl/pptp')
-rw-r--r--accel-pppd/ctrl/pptp/pptp.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/accel-pppd/ctrl/pptp/pptp.c b/accel-pppd/ctrl/pptp/pptp.c
index 715a77b..b9930f3 100644
--- a/accel-pppd/ctrl/pptp/pptp.c
+++ b/accel-pppd/ctrl/pptp/pptp.c
@@ -298,6 +298,9 @@ static int pptp_out_call_rqst(struct pptp_conn_t *conn)
log_ppp_error("failed to create PPTP socket (%s)\n", strerror(errno));
return -1;
}
+
+ fcntl(pptp_sock, F_SETFD, fcntl(pptp_sock, F_GETFD) | FD_CLOEXEC);
+
if (bind(pptp_sock, (struct sockaddr*)&src_addr, sizeof(src_addr))) {
log_ppp_error("failed to bind PPTP socket (%s)\n", strerror(errno));
close(pptp_sock);
@@ -741,7 +744,10 @@ static void pptp_init(void)
log_emerg("pptp: failed to create server socket: %s\n", strerror(errno));
return;
}
- addr.sin_family = AF_INET;
+
+ fcntl(serv.hnd.fd, F_SETFD, fcntl(serv.hnd.fd, F_GETFD) | FD_CLOEXEC);
+
+ addr.sin_family = AF_INET;
addr.sin_port = htons(PPTP_PORT);
opt = conf_get_opt("pptp", "bind");