Fix a possible (albeit unlikely) resource leak identified by Coverity.
If we encounter an error in opening a socket, make sure that we return
from that function early, as appropriate (found by Coverity).
Explicitly ignore the fcntl(2) return value when opening a log fd; there
is no existing log fd that we can use at that point for reporting the
error.
If setting a socket back to blocking mode fails, propagate that error to
the caller, just as we do when setting the socket to nonblocking mode.
Found by Coverity.
Explicitly ignore the fcntl(2) return value for data sockets.
Be more paranoid about checking return values, prompted by Coverity.
Propagate -- and check for -- more return values, prompted by Coverity.
At least log, via trace logging, if fcntl(F_SETOWN) fails.
Per Coverity, make sure that we check for, and handle errors, when calling
getsockopt(2).
Explicitly ignore fcntl(2) return values here.
Per Coverity, at least log the fcntl(2) error when trying to set CLOEXEC
on an fd opened to talk to an SSH agent.
Prompted by Coverity, log (rather than ignoring) return values.
If we have a problem sending a message via syslog, try (at least) to report
it via STDERR.
Log, via trace logging, a should-never-fail error.
Log, via trace logging, if we fail to add a session note.
If mod_delay has issues blocking/unblocking signals, log the reason why
via trace logging.
Be consistent with the datatype used for the hostkey length throughout the
KEX API.
Use proper blocks, especially when dealing with macro expansion, to make clear
what is happening (and what is in scope).
Remove unnecessary tertiary operator.
If mod_sftp is interrupted when reading from a socket, then retry that
read(2) call again, rather than just looping infinitely.