Menu

#39 aterm may be locked in select()

closed-fixed
nobody
None
5
2003-11-02
2002-07-28
No

Hi,

there's a problem in command.c. First you should not
do FD_ISSET if select() returned -1. The critical
problem is (it's not your fault) that FD_SETSIZE
and syconf(_SC_OPEN_MAX) may tell you different values.
Unfortunately (at least with NetBSD) FD_ZERO, FD_SET,
FD_ISSET are macros which use the constant value of
FD_SETSIZE. This means if the admin/user has set the
max. open-file-limit to a value above FD_SETSIZE
FD_ZERO does not clear any bits above FD_SETSIZE and
select() may return -1 with errno=EBADF because the
value of bits above FD_SETSIZE is undeterminated.

Regards,
Christian

Discussion

  • Anonymous

    Anonymous - 2002-07-28

    command.c.patch

     
  • Göran Weinholt

    Göran Weinholt - 2003-11-02

    Logged In: YES
    user_id=51181

    aterm doesn't use num_fds in the select loop any longer.

     
  • Göran Weinholt

    Göran Weinholt - 2003-11-02
    • status: open --> closed-fixed
     

Log in to post a comment.