File: accept.c

package info (click to toggle)
socks4-server 4.3.beta2-9
  • links: PTS
  • area: main
  • in suites: potato
  • size: 1,532 kB
  • ctags: 1,777
  • sloc: ansic: 19,309; makefile: 400; sh: 69
file content (31 lines) | stat: -rw-r--r-- 679 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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;
}