summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@rei2.9hal>2012-03-02 06:40:40 +0100
committercinap_lenrek <cinap_lenrek@rei2.9hal>2012-03-02 06:40:40 +0100
commitfa74649d188a22ef68a889cd2794697445df31fb (patch)
tree0e563de4448395e51704c01e30ab2dc38aee9e9c
parent2fec3c0bc8b160b1a2594805a779a7d04ab6a1ea (diff)
socksd: use note to shoot down relay procs
-rw-r--r--sys/src/cmd/ip/socksd.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/sys/src/cmd/ip/socksd.c b/sys/src/cmd/ip/socksd.c
index 2128a5ff6..3b5dc140f 100644
--- a/sys/src/cmd/ip/socksd.c
+++ b/sys/src/cmd/ip/socksd.c
@@ -100,7 +100,7 @@ main(int argc, char *argv[])
uchar buf[8*1024], *p;
char dir[40], *s;
NetConnInfo *nc;
- int fd, cfd, n;
+ int fd, n;
fmtinstall('I', eipfmt);
@@ -180,21 +180,19 @@ main(int argc, char *argv[])
nc = nil;
dir[0] = 0;
- fd = cfd = -1;
+ fd = -1;
switch(buf[1]){
case 0x01: /* CONNECT */
if((s = addr2str("tcp", buf)) == nil)
return;
- fd = dial(s, 0, dir, &cfd);
+ fd = dial(s, 0, dir, 0);
break;
}
if(fd >= 0){
if((nc = getnetconninfo(dir, -1)) == nil){
- if(cfd >= 0)
- close(cfd);
close(fd);
- fd = cfd = -1;
+ fd = -1;
}
}
@@ -222,7 +220,7 @@ main(int argc, char *argv[])
if(write(1, buf, n) != n)
return;
- /* reley data */
+ /* relay data */
switch(rfork(RFMEM|RFPROC|RFFDG|RFNOWAIT)){
case -1:
return;
@@ -232,12 +230,10 @@ main(int argc, char *argv[])
default:
dup(fd, 1);
}
- close(fd);
while((n = read(0, buf, sizeof(buf))) > 0)
if(write(1, buf, n) != n)
break;
- if(cfd >= 0)
- hangup(cfd);
+ postnote(PNGROUP, getpid(), "kill");
exits(0);
}