1
0
mirror of https://github.com/rofl0r/proxychains-ng synced 2025-01-04 19:22:52 +08:00
This commit is contained in:
Guilherme Janczak 2024-09-29 02:04:22 -04:00 committed by GitHub
commit 9155523d72
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 7 deletions

3
configure vendored
View File

@ -223,9 +223,6 @@ check_define __FreeBSD__ && bsd_detected=true
check_define __OpenBSD__ && { check_define __OpenBSD__ && {
bsd_detected=true bsd_detected=true
echo "CFLAGS+=-DIS_OPENBSD">>config.mak echo "CFLAGS+=-DIS_OPENBSD">>config.mak
check_compile_run 'whether OpenBSDs fclose() (illegally) calls close()' \
'#include <stdio.h>\n#include<stdlib.h>\nint close(int x){exit(0);}int main(){fclose(stdin);return 1;}' && \
OUR_CPPFLAGS="$OUR_CPPFLAGS -DBROKEN_FCLOSE"
} }
check_define __sun && check_define __SVR4 && solaris_detected=true check_define __sun && check_define __SVR4 && solaris_detected=true
check_define __HAIKU__ && haiku_detected=true check_define __HAIKU__ && haiku_detected=true

View File

@ -115,7 +115,7 @@ typedef struct {
unsigned int first, last, flags; unsigned int first, last, flags;
} close_range_args_t; } close_range_args_t;
/* If there is some `close` or `close_range` system call before do_init, /* If there is some `close` or `close_range` system call before do_init,
we buffer it, and actually execute them in do_init. */ we buffer it, and actually execute them in do_init. */
static int close_fds[16]; static int close_fds[16];
static int close_fds_cnt = 0; static int close_fds_cnt = 0;
@ -560,9 +560,7 @@ inv_host:
} }
} }
} }
#ifndef BROKEN_FCLOSE
fclose(file); fclose(file);
#endif
if(!count) { if(!count) {
fprintf(stderr, "error: no valid proxy found in config\n"); fprintf(stderr, "error: no valid proxy found in config\n");
exit(1); exit(1);
@ -639,7 +637,7 @@ HOOKFUNC(int, close_range, unsigned first, unsigned last, int flags) {
int protected_fds[] = {req_pipefd[0], req_pipefd[1], resp_pipefd[0], resp_pipefd[1]}; int protected_fds[] = {req_pipefd[0], req_pipefd[1], resp_pipefd[0], resp_pipefd[1]};
intsort(protected_fds, 4); intsort(protected_fds, 4);
/* We are skipping protected_fds while calling true_close_range() /* We are skipping protected_fds while calling true_close_range()
* If protected_fds cut the range into some sub-ranges, we close sub-ranges BEFORE cut point in the loop. * If protected_fds cut the range into some sub-ranges, we close sub-ranges BEFORE cut point in the loop.
* [first, cut1-1] , [cut1+1, cut2-1] , [cut2+1, cut3-1] * [first, cut1-1] , [cut1+1, cut2-1] , [cut2+1, cut3-1]
* Finally, we delete the remaining sub-range, outside the loop. [cut3+1, tail] * Finally, we delete the remaining sub-range, outside the loop. [cut3+1, tail]
*/ */