X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/a7dc44d27d019f57d9ce484feb8d1a363464102b..931a979904a17a28af6265b60a088824edb78fa7:/socket.c diff --git a/socket.c b/socket.c index 6a13b04a..eb0660bb 100644 --- a/socket.c +++ b/socket.c @@ -70,7 +70,7 @@ static int establish_proxy_connection(int fd, char *host, int port) buffer); return -1; } - for (cp = &buffer[5]; isdigit((int) *cp) || (*cp == '.'); cp++) + for (cp = &buffer[5]; isdigit(* (unsigned char *) cp) || (*cp == '.'); cp++) ; while (*cp == ' ') cp++; @@ -374,7 +374,7 @@ int is_a_socket(int fd) } -void start_accept_loop(int port, int (*fn)(int )) +void start_accept_loop(int port, int (*fn)(int, int)) { int s; extern char *bind_address; @@ -429,11 +429,14 @@ void start_accept_loop(int port, int (*fn)(int )) #endif if ((pid = fork()) == 0) { + int ret; close(s); /* open log file in child before possibly giving up privileges */ log_open(); - _exit(fn(fd)); + ret = fn(fd, fd); + close_all(); + _exit(ret); } else if (pid < 0) { rprintf(FERROR, RSYNC_NAME