Mike Stroyan wrote: > 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.
If you look closely at move_to_high_fd(), you see that it attempts to avoid file descriptors already in use. Only if fcntl(fd, F_GETFD, ...) returns -1 does it conclude that file descriptor fd is available. One can debate whether or not we should be checking explicitly for EBADF, but that's the only value of errno that's valid for F_GETFD anyway. I'd be interested in knowing why fcntl didn't return -1, if the parent process really did leave the file descriptor open and didn't set the close-on-exec flag. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer Live Strong. No day but today. Chet Ramey, ITS, CWRU [EMAIL PROTECTED] http://cnswww.cns.cwru.edu/~chet/ _______________________________________________ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash