Mercurial > cpython-lru_cache-weakref
diff Modules/selectmodule.c @ 1746:1940892d2fe3 legacy-trunk
Merge alpha100 branch back to main trunk
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Mon, 01 Aug 1994 11:34:53 +0000 |
| parents | 0ffff40d13ff |
| children | 172ba04a5191 |
line wrap: on
line diff
--- a/Modules/selectmodule.c Mon Aug 01 11:18:30 1994 +0000 +++ b/Modules/selectmodule.c Mon Aug 01 11:34:53 1994 +0000 @@ -1,5 +1,5 @@ /*********************************************************** -Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum, +Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum, Amsterdam, The Netherlands. All Rights Reserved @@ -28,7 +28,8 @@ #include "modsupport.h" #include "ceval.h" -#include "myselect.h" +#include <sys/types.h> +#include "myselect.h" /* Also includes mytime.h */ static object *SelectError; @@ -63,12 +64,13 @@ err_badarg(); return -1; } - if ( v >= FD_SETSIZE ) { - err_setstr(SystemError, "FD_SETSIZE too low in select()"); + if ( v < 0 || v >= FD_SETSIZE ) { + err_setstr(ValueError, "filedescriptor out of range in select()"); return -1; } if ( v > max ) max = v; FD_SET(v, set); + XDECREF(fd2obj[v]); fd2obj[v] = o; } return max+1; @@ -91,11 +93,12 @@ for(i=0; i<max; i++) if ( FD_ISSET(i,set) ) { if ( i > FD_SETSIZE ) { - err_setstr(SystemError, "FD_SETSIZE too low in select()"); + err_setstr(SystemError, + "filedescriptor out of range returned in select()"); return NULL; } o = fd2obj[i]; - if ( o == 0 ) { + if ( o == NULL ) { err_setstr(SystemError, "Bad filedescriptor returned from select()"); return NULL;
