commit 15a16d3a29e679cef686f6d18cc743fb7f1f1180
parent 24de00cb12e58042c0b440f5fc0c10747c9fc305
Author: Alexander Burger <abu@software-lab.de>
Date: Mon, 4 Feb 2013 14:12:42 +0100
Bug in 'accept' on BSD (inherited non-blocking mode)
Diffstat:
8 files changed, 24 insertions(+), 19 deletions(-)
diff --git a/CHANGES b/CHANGES
@@ -1,4 +1,5 @@
* DDmmm13 picoLisp-3.1.2
+ Bug in 'accept' on BSD
'+Hook2' index prefix class
Password hashing
'usec' optional 'flg' argument
diff --git a/ersatz/picolisp.jar b/ersatz/picolisp.jar
Binary files differ.
diff --git a/lib/map b/lib/map
@@ -24,7 +24,7 @@ $ (2967 . "@src64/flow.l")
>= (2297 . "@src64/subr.l")
>> (2627 . "@src64/big.l")
abs (2731 . "@src64/big.l")
-accept (145 . "@src64/net.l")
+accept (148 . "@src64/net.l")
adr (587 . "@src64/main.l")
alarm (473 . "@src64/main.l")
all (788 . "@src64/sym.l")
@@ -96,7 +96,7 @@ commit (1403 . "@src64/db.l")
con (725 . "@src64/subr.l")
conc (781 . "@src64/subr.l")
cond (1919 . "@src64/flow.l")
-connect (224 . "@src64/net.l")
+connect (227 . "@src64/net.l")
cons (747 . "@src64/subr.l")
copy (1225 . "@src64/subr.l")
ctl (4269 . "@src64/io.l")
@@ -158,7 +158,7 @@ hash (2976 . "@src64/big.l")
head (1820 . "@src64/subr.l")
heap (519 . "@src64/main.l")
hear (3246 . "@src64/io.l")
-host (190 . "@src64/net.l")
+host (193 . "@src64/net.l")
id (1028 . "@src64/db.l")
idx (2171 . "@src64/sym.l")
if (1805 . "@src64/flow.l")
@@ -186,7 +186,7 @@ lines (3870 . "@src64/io.l")
link (1172 . "@src64/subr.l")
lisp (2244 . "@src64/main.l")
list (887 . "@src64/subr.l")
-listen (157 . "@src64/net.l")
+listen (160 . "@src64/net.l")
lit (150 . "@src64/flow.l")
load (4186 . "@src64/io.l")
lock (1185 . "@src64/db.l")
@@ -332,7 +332,7 @@ trail (698 . "@src64/main.l")
trim (1759 . "@src64/subr.l")
try (1177 . "@src64/flow.l")
type (920 . "@src64/flow.l")
-udp (301 . "@src64/net.l")
+udp (304 . "@src64/net.l")
unify (3950 . "@src64/subr.l")
unless (1901 . "@src64/flow.l")
until (2085 . "@src64/flow.l")
diff --git a/src/net.c b/src/net.c
@@ -1,4 +1,4 @@
-/* 07jan13abu
+/* 04feb13abu
* (c) Software Lab. Alexander Burger
*/
@@ -74,6 +74,7 @@ static any tcpAccept(int sd) {
socklen_t len = sizeof(addr);
if ((sd2 = accept(sd, (struct sockaddr*)&addr, &len)) >= 0) {
fcntl(sd, F_SETFL, f);
+ fcntl(sd2, F_SETFL, 0);
inet_ntop(AF_INET6, &addr.sin6_addr, s, INET6_ADDRSTRLEN);
val(Adr) = mkStr(s);
initInFile(sd2,NULL), initOutFile(sd2);
diff --git a/src/vers.h b/src/vers.h
@@ -1 +1 @@
-static byte Version[4] = {3,1,1,9};
+static byte Version[4] = {3,1,1,10};
diff --git a/src64/net.l b/src64/net.l
@@ -1,4 +1,4 @@
-# 05jan13abu
+# 04feb13abu
# (c) Software Lab. Alexander Burger
# (port ['T] 'cnt|(cnt . cnt) ['var]) -> cnt
@@ -119,6 +119,9 @@
if ns # Yes
xchg A (S) # Save new socket, retrieve flags
cc fcntl(E F_SETFL A) # Restore socket status flags
+ ? (<> *TargetOS "Linux") # Non-Linux (BSD sockets)?
+ cc fcntl((S) F_SETFL 0) # Yes: Set new socket to non-blocking
+ =
sub S (%% INET6_ADDRSTRLEN) # Allocate name buffer
cc inet_ntop(AF_INET6 &(Addr SIN6_ADDR) S INET6_ADDRSTRLEN)
ld E S
diff --git a/src64/tags b/src64/tags
@@ -1241,17 +1241,17 @@ sys/x86-64.linux.defs.l,1959
cmpDfltA_F4132,90414
cmpUserAX_F4137,90565
-./net.l,191
+./net.l,192
doPort5,96
tcpAcceptA_FE109,2796
-doAccept145,4032
-doListen157,4268
-doHost190,4941
-doConnect224,5824
-serverCEY_FE273,7028
-doUdp301,7792
-getUdpZ_FB370,9724
-putUdpBZ377,9869
+doAccept148,4180
+doListen160,4416
+doHost193,5089
+doConnect227,5972
+serverCEY_FE276,7176
+doUdp304,7940
+getUdpZ_FB373,9872
+putUdpBZ380,10017
sys/x86-64.linux.code.l,94
errno_A5,67
diff --git a/src64/version.l b/src64/version.l
@@ -1,6 +1,6 @@
-# 31jan13abu
+# 04feb13abu
# (c) Software Lab. Alexander Burger
-(de *Version 3 1 1 9)
+(de *Version 3 1 1 10)
# vi:et:ts=3:sw=3