bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Does HIGH_FD_MAX have to be so low?


From: Mike Stroyan
Subject: Does HIGH_FD_MAX have to be so low?
Date: Thu, 19 Oct 2006 12:42:16 -0600
User-agent: Mutt/1.5.9i

  I was recently helping to debug a problem with an application getting
bad file descriptor errors when run from a shell wrapper script.  The
cause was that the parent process left fildes 255 open for the child
process, but the bash wrapper script was causing fildes 255 to be
closed.

  Looking at open_shell_script() in shell.c and move_to_high_fd() in
general.c, I find that the code will force the use of fildes 255,
(HIGH_FD_MAX), for reading the shell script when getdtablesize() reports
that the maximum allowed file descriptor value is greater than 255.
In this particular case the maximum file descriptor value was 1023,
which would have stayed out of the way of the application's use.

  Does HIGH_FD_MAX need to be so low?  (OK.  255 isn't _REALLY_ low.)
Are there negative consequences for using a higher file descriptor when
getdtablesize() reports that they are allowed?

-- 
Mike Stroyan, address@hidden




reply via email to

[Prev in Thread] Current Thread [Next in Thread]