socks4-server (4.3.beta2-18) runsocks/accept.c

Summary

 runsocks/accept.c |   31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

    
download this patch

Patch contents

--- socks4-server-4.3.beta2.orig/runsocks/accept.c
+++ socks4-server-4.3.beta2/runsocks/accept.c
@@ -0,0 +1,31 @@
+#include <sys/types.h>
+#include <sys/socket.h>
+
+#include <stdio.h>
+
+#include "wrap.h"
+
+int REAL(accept)(int  sockfd, struct sockaddr *addr, socklen_t *addrlen )
+{
+  GETFUNC("accept", TRY_LIBC, -1, (int (*)(int  sockfd, struct sockaddr *addr, socklen_t *addrlen )), (sockfd, addr, addrlen), int);
+}
+
+int  accept(int  sockfd, struct sockaddr *addr, socklen_t *addrlen )
+{
+  int ret;
+
+//  printf("accept(%d)\n", InSocksFunctions);
+
+  InSocksFunctions++;
+
+  if (InSocksFunctions == 1)
+    ret = LIBPREFIX(accept)(sockfd, addr, addrlen);
+  else
+    ret = REAL(accept)(sockfd, addr, addrlen);
+
+  InSocksFunctions--;
+
+//  printf("accept(%d) ende\n", InSocksFunctions);
+
+  return ret;
+}