Now that file descriptor limits are soft, and can be larger than
authorKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Sat, 29 Apr 1995 07:15:38 +0000 (23:15 -0800)
committerKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Sat, 29 Apr 1995 07:15:38 +0000 (23:15 -0800)
FD_SETSIZE, using the value of getdtablesize() as an input to select()
does not work.  We fixed this in our RPC code a while back.  Here's a
patch to make window(1) work more correctly.
From: Charles Hannum <mycroft@NetBSD.ORG>

SCCS-vsn: usr.bin/window/wwinit.c 8.2
SCCS-vsn: usr.bin/window/wwopen.c 8.2

usr/src/usr.bin/window/wwinit.c
usr/src/usr.bin/window/wwopen.c

index aad308b..220f80f 100644 (file)
@@ -9,7 +9,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)wwinit.c   8.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)wwinit.c   8.2 (Berkeley) %G%";
 #endif /* not lint */
 
 #include "ww.h"
 #endif /* not lint */
 
 #include "ww.h"
@@ -24,7 +24,7 @@ wwinit()
        char *kp;
        int s;
 
        char *kp;
        int s;
 
-       wwdtablesize = getdtablesize();
+       wwdtablesize = 3;
        wwhead.ww_forw = &wwhead;
        wwhead.ww_back = &wwhead;
 
        wwhead.ww_forw = &wwhead;
        wwhead.ww_back = &wwhead;
 
index 24ea422..43182b0 100644 (file)
@@ -9,7 +9,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)wwopen.c   8.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)wwopen.c   8.2 (Berkeley) %G%";
 #endif /* not lint */
 
 #include "ww.h"
 #endif /* not lint */
 
 #include "ww.h"
@@ -90,6 +90,8 @@ wwopen(flags, nrow, ncol, row, col, nline)
                }
                w->ww_obe = w->ww_ob + 512;
                w->ww_obp = w->ww_obq = w->ww_ob;
                }
                w->ww_obe = w->ww_ob + 512;
                w->ww_obp = w->ww_obq = w->ww_ob;
+               if (w->ww_pty >= wwdtablesize)
+                       wwdtablesize = w->ww_pty + 1;
        }
 
        w->ww_win = wwalloc(w->ww_w.t, w->ww_w.l,
        }
 
        w->ww_win = wwalloc(w->ww_w.t, w->ww_w.l,