1
0
mirror of https://github.com/rofl0r/proxychains-ng synced 2026-05-15 01:52:34 +08:00

hook close() to prevent rude programs like ssh to close our pipes

those pipes are needed to talk with the dns-name allocator thread.

closes #9
This commit is contained in:
rofl0r
2013-01-21 01:54:45 +01:00
Unverified
parent a8e8cced6d
commit 1da09e49e5
4 changed files with 26 additions and 3 deletions
+10 -3
View File
@@ -8,6 +8,7 @@
#include <string.h>
#include <stdint.h>
#include <stddef.h>
#include <errno.h>
#include "allocator_thread.h"
#include "shm.h"
#include "debug.h"
@@ -147,8 +148,8 @@ struct at_msghdr {
static pthread_t allocator_thread;
static pthread_attr_t allocator_thread_attr;
static int req_pipefd[2];
static int resp_pipefd[2];
int req_pipefd[2];
int resp_pipefd[2];
static int wait_data(int readfd) {
PFUNC();
@@ -158,7 +159,13 @@ static int wait_data(int readfd) {
int ret;
while((ret = select(readfd+1, &fds, NULL, NULL, NULL)) <= 0) {
if(ret < 0) {
perror("select2");
int e = errno;
if(e == EINTR) continue;
#ifdef __GLIBC__
char emsg[1024];
char* x = strerror_r(errno, emsg, sizeof emsg);
dprintf(2, "select2: %s\n", x);
#endif
return 0;
}
}