File: bind.c

package info (click to toggle)
socks4-server 4.3.beta2-20
  • links: PTS
  • area: main
  • in suites: buster, stretch
  • size: 1,512 kB
  • ctags: 1,778
  • sloc: ansic: 19,305; makefile: 399; sh: 52
file content (34 lines) | stat: -rw-r--r-- 721 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
32
33
34
#include <sys/types.h>
#include <sys/socket.h>

#include <unistd.h>

#include "wrap.h"

int REAL(bind)(int  sockfd, __const struct sockaddr *my_addr, socklen_t addrlen )
{
  GETFUNC("bind", TRY_LIBC, -1, (int (*)(int  sockfd, __const struct sockaddr *my_addr, socklen_t addrlen )), (sockfd, my_addr, addrlen), int);
}

int  bind(int  sockfd, __const struct sockaddr *my_addr, socklen_t addrlen )
{
  int ret;

//  printf("bind(%d)\n", InSocksFunctions);

  InSocksFunctions++;

  doinit();
  
  if (InSocksFunctions == 1)
    ret = LIBPREFIX(bind)(sockfd, my_addr, addrlen);
  else
    ret = REAL(bind)(sockfd, my_addr, addrlen);


  InSocksFunctions--;

//  printf("bind(%d) ende\n", InSocksFunctions);

  return ret;
}