[TriLUG] sshd: select: bad file number

James Olin Oden james.oden at gmail.com
Tue Jan 15 10:11:04 EST 2008


On Jan 15, 2008 8:10 AM,  <jbrigman at nc.rr.com> wrote:
> Can anyone shed some light on the meaning and origin of this error message? I've seen it in Solaris when sending an incorrect command down an ssh connection. The result gets reported back via STDERR by the local ssh client when one sends an incorrect command down the pipe (like "helg" instead of "help") via script, and some buffer along the way seems to fill up with command results. The problem it creates for me is twofold:
>
> 1) It comes back to me in a manner that I can't predict, causing problems if I try to parse STDERR,
> 2) It "looks" like an error on the remote machine, but it's not. I can reproduce it on only one solaris system in the house.
>
>  I understand the reporting program is "sshd", but I don't understand what facility "select" is. "bad file number" seems like it ought to be the magic number but I can't see what that's got to do with sending a command down the pipe.
>
select() is a system call used to tell if any filehandles of a given
set of filehandles need servicing (i.e if they need to be read from or
are ready to be written too).  It essentially allows one to avoid
deadlock situations incurred when dealing with mutliple readers, and
also is generally a more efficient mechanism in that it can be told to
block for some amount of time, and thus while you blocking the
processor can be used for something else (anyway there is a man page
if you want to check it out).  The error mess of select on a
bad file handle means that the file handle (every open file in a
process has a filehandle associated with it) is not one that is
presently in use.

Anyway that is what the error means.

Cheers...james



More information about the TriLUG mailing list