[Commit] nickle file.c,1.47,1.48
Keith Packard
commit@keithp.com
Thu, 29 May 2003 00:47:35 -0700
- Previous message: [Commit] rrserver array.5c,NONE,1.1 boards.5c,NONE,1.1 connect.5c,NONE,1.1 dispatch.5c,NONE,1.1 games.5c,NONE,1.1 lex.5c,NONE,1.1 main.5c,NONE,1.1 net.5c,NONE,1.1 rr.5c,NONE,1.1 server.5c,NONE,1.1 show.5c,NONE,1.1 shuffle.5c,NONE,1.1 readreq.5c,1.1,1.2 rrnet.5c,1.1,NONE rrparse.5c,1.1,NONE rrproto.5c,1.1,NONE rrserver.5c,1.1,NONE rrservreq.5c,1.1,NONE
- Next message: [Commit] rrserver array.5c,1.1,1.2 boards.5c,1.1,1.2 connect.5c,1.1,1.2 dispatch.5c,1.1,1.2 games.5c,1.1,1.2 lex.5c,1.1,1.2 server.5c,1.1,1.2 show.5c,1.1,1.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Committed by: keithp
Update of /local/src/CVS/nickle
In directory home.keithp.com:/tmp/cvs-serv15639
Modified Files:
file.c
Log Message:
Detect read/write blocks on closed files
Index: file.c
===================================================================
RCS file: /local/src/CVS/nickle/file.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -d -r1.47 -r1.48
--- file.c 23 Apr 2003 03:11:28 -0000 1.47
+++ file.c 29 May 2003 07:47:33 -0000 1.48
@@ -1618,7 +1618,6 @@
ENTER ();
fd_set readable, writable;
int n, fd;
- struct timeval tv, *tvp;
Value blocked, *prev;
Bool ready;
Bool writeBlocked;
@@ -1627,9 +1626,14 @@
FD_ZERO (&readable);
FD_ZERO (&writable);
n = 0;
- for (blocked = fileBlocked; blocked; blocked = blocked->file.next)
+ for (prev = &fileBlocked; (blocked = *prev); )
{
fd = blocked->file.fd;
+ if (fd < 0)
+ {
+ *prev = blocked->file.next;
+ continue;
+ }
if (fd < 3 && !ownTty[fd])
continue;
if (blocked->file.flags & FileInputBlocked)
@@ -1638,17 +1642,26 @@
FD_SET (fd, &writable);
if (fd >= n)
n = fd + 1;
+ prev = &blocked->file.next;
+ }
+ if (n > 0)
+ {
+ struct timeval tv, *tvp;
+ if (block)
+ tvp = 0;
+ else
+ {
+ tv.tv_usec = 0;
+ tv.tv_sec = 0;
+ tvp = &tv;
+ }
+ n = select (n, &readable, &writable, 0, tvp);
}
- if (block)
- tvp = 0;
else
{
- tv.tv_usec = 0;
- tv.tv_sec = 0;
- tvp = &tv;
+ anyFileWriteBlocked = False;
+ anyFileReadBlocked = False;
}
- if (n > 0)
- n = select (n, &readable, &writable, 0, tvp);
if (n > 0)
{
writeBlocked = False;
- Previous message: [Commit] rrserver array.5c,NONE,1.1 boards.5c,NONE,1.1 connect.5c,NONE,1.1 dispatch.5c,NONE,1.1 games.5c,NONE,1.1 lex.5c,NONE,1.1 main.5c,NONE,1.1 net.5c,NONE,1.1 rr.5c,NONE,1.1 server.5c,NONE,1.1 show.5c,NONE,1.1 shuffle.5c,NONE,1.1 readreq.5c,1.1,1.2 rrnet.5c,1.1,NONE rrparse.5c,1.1,NONE rrproto.5c,1.1,NONE rrserver.5c,1.1,NONE rrservreq.5c,1.1,NONE
- Next message: [Commit] rrserver array.5c,1.1,1.2 boards.5c,1.1,1.2 connect.5c,1.1,1.2 dispatch.5c,1.1,1.2 games.5c,1.1,1.2 lex.5c,1.1,1.2 server.5c,1.1,1.2 show.5c,1.1,1.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]