diff options
Diffstat (limited to 'Modules/selectmodule.c')
| -rw-r--r-- | Modules/selectmodule.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/Modules/selectmodule.c b/Modules/selectmodule.c index 2cae7f44d9..ef3ec23346 100644 --- a/Modules/selectmodule.c +++ b/Modules/selectmodule.c @@ -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 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #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 @@ list2set(list, set, fd2obj) 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 @@ set2list(set, max, fd2obj) 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; |
