hello,

I've a question regarding chan_shutdown_read.

This morning, while analysing the logs of one of my servers, I found several
lines like the following:

<snip source="syslog.log">
Oct 25 11:07:35 myhost sshd[...]: error: channel 2: chan_shutdown_read:
shutdown() failed for fd11 [i1 o16]: Invalid argument
Oct 25 11:07:52 myhost sshd[...]: error: channel 2: chan_shutdown_read:
shutdown() failed for fd11 [i1 o16]: Invalid argument
Oct 25 11:11:39 myhost sshd[...]: error: channel 2: chan_shutdown_read:
shutdown() failed for fd11 [i1 o128]: Invalid argument
</snip>

The host is a HP-UX B.11.11 U 9000/800 (lets call it Host A) . The users are
doing ssh session from another host (Host B) to Host A with 
port forwarding.

>From the source of chan_shutdown_read function, I understand that  this
error is reported due to the fact that when Host A try to close the channel
and 
Host B (the writing part) has already closed it. 

<snip source="nchan.c">
        ...
        /*
        * shutdown(sock, SHUT_READ) may return ENOTCONN if the
        * write side has been closed already. (bug on Linux)
        * HP-UX will return EINVAL.
        */
        if (shutdown(c->sock, SHUT_RD) < 0
                && (errno != ENOTCONN && errno != EINVAL))
                error("channel %d: chan_shutdown_read: shutdown() failed for
fd%d [i%d o%d]: %.100s",
                c->self, c->sock, c->istate, c->ostate, strerror(errno));
        ...
</snip>
Looking at the code, I don't understand why I still have the "Invalid
argument" error reported. I'm under HP-UX so if errno is set to EINVAL
(which seems to be the case, according
to the logs), I should not get an error in the logs. 

Is it due to something else ? Am' I missing something ? Is it due to the
version 11.11 of HP-UX which does not return an EINVAL in case of the socket
closed by the writing part ?

Thank you for your help.

Gr�goire Welraeds

Consultant
Logica Belgium

Tel. : + 32 (0)2 708 6305
E-mail: [EMAIL PROTECTED]
http://www.logica.com



This e-mail and any attachment is for authorised use by the intended recipient(s) 
only.  It may contain proprietary material, confidential information and/or be subject 
to legal privilege.  It should not be copied, disclosed to, retained or used by, any 
other party.  If you are not an intended recipient then please promptly delete this 
e-mail and any attachment and all copies and inform the sender.  Thank you.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to