Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/rofl0r/proxychains-ng.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrofl0r <retnyg@gmx.net>2016-02-04 15:49:43 +0300
committerrofl0r <retnyg@gmx.net>2016-02-04 15:49:49 +0300
commitb64c89e0e49e75227f06cc43f9affd22bdcfff3f (patch)
treec96201c83a3821b72e9ac71d59aa751e3e234069
parenta1c31e73b6b094948daa9d77a429548017538f1c (diff)
add check for broken OpenBSD fclose()
http://marc.info/?l=openbsd-bugs&m=145280872431093&w=2 closes #95
-rwxr-xr-xconfigure26
-rw-r--r--src/libproxychains.c2
2 files changed, 28 insertions, 0 deletions
diff --git a/configure b/configure
index 1cd85af..939fccb 100755
--- a/configure
+++ b/configure
@@ -32,6 +32,27 @@ check_compile() {
return $res
}
+check_define() {
+ printf "checking whether \$CC defines %s ... " "$1"
+ local res=1
+ $CC $CPPFLAGS $CFLAGS -dM -E - </dev/null | grep "$1" >/dev/null && res=0
+ test x$res = x0 && printf "yes\n" || printf "no\n"
+ return $res
+}
+
+check_compile_run() {
+ printf "checking %s ... " "$1"
+ local tmp=$(mktemp)
+ printf "$2" > "$tmp".c
+ local res=0
+ $CC $CPPFLAGS $CFLAGS "$tmp".c -o "$tmp".out >/dev/null 2>&1 \
+ || res=1
+ test x$res = x0 && { "$tmp".out || res=1 ; }
+ rm -f "$tmp".c "$tmp".o "$tmp".out
+ test x$res = x0 && printf "yes\n" || printf "no\n"
+ return $res
+}
+
usage() {
echo "supported arguments"
echo "--prefix=/path default: $prefix"
@@ -111,6 +132,11 @@ check_compile 'whether netinet/in.h defines __u6_addr.__u6_addr16' \
'#include <netinet/in.h>\nint main(int a, char**c){struct in6_addr x={.s6_addr32[0]=a};return x.s6_addr16[0]; }'
}
+check_define __OpenBSD__ && \
+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;}' && \
+CPPFLAGS="$CPPFLAGS -DBROKEN_FCLOSE"
+
echo CC?=$CC>config.mak
[ -z "$CPPFLAGS" ] || echo CPPFLAGS?=$CPPFLAGS>>config.mak
[ -z "$CFLAGS" ] || echo USER_CFLAGS?=$CFLAGS>>config.mak
diff --git a/src/libproxychains.c b/src/libproxychains.c
index 4c12511..ec18496 100644
--- a/src/libproxychains.c
+++ b/src/libproxychains.c
@@ -290,7 +290,9 @@ static void get_chain_data(proxy_data * pd, unsigned int *proxy_count, chain_typ
}
}
}
+#ifndef BROKEN_FCLOSE
fclose(file);
+#endif
if(!count) {
fprintf(stderr, "error: no valid proxy found in config\n");
exit(1);