[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [tor/master] Merge remote-tracking branch 'origin/maint-0.2.2'
commit d9edee3a3b98eaae5192f1307197d1a33122ec61
Merge: f78fc8c 2b5a035
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date: Fri Dec 2 16:10:17 2011 -0500
Merge remote-tracking branch 'origin/maint-0.2.2'
changes/bug4535 | 3 +++
src/common/compat.c | 2 +-
src/common/compat.h | 2 +-
3 files changed, 5 insertions(+), 2 deletions(-)
diff --cc src/common/compat.c
index ea95f9f,a4e5074..33e2864
--- a/src/common/compat.c
+++ b/src/common/compat.c
@@@ -979,19 -934,10 +979,19 @@@ tor_open_socket(int domain, int type, i
/** As socket(), but counts the number of open sockets. */
tor_socket_t
- tor_accept_socket(int sockfd, struct sockaddr *addr, socklen_t *len)
+ tor_accept_socket(tor_socket_t sockfd, struct sockaddr *addr, socklen_t *len)
{
- tor_socket_t s = accept(sockfd, addr, len);
+ tor_socket_t s;
+#if defined(HAVE_ACCEPT4) && defined(SOCK_CLOEXEC)
+#define LINUX_CLOEXEC_ACCEPT
+ s = accept4(sockfd, addr, len, SOCK_CLOEXEC);
+#else
+ s = accept(sockfd, addr, len);
+#endif
if (SOCKET_OK(s)) {
+#if !defined(LINUX_CLOEXEC_ACCEPT) && defined(FD_CLOEXEC)
+ fcntl(s, F_SETFD, FD_CLOEXEC);
+#endif
socket_accounting_lock();
++n_sockets_open;
mark_socket_open(s);
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits