I was playing around with the `internal-only' -MC option and was
slightly confused by its behaviour when stdin/out is a tty. So, I
straced it and found ...
-anarres:~> really strace exim -MC smtp davenant.davenant.greenend.org.uk 1 0yHxrt-000053-00
...
getpid() = 348
send(0, "MAIL FROM:<ian@???"..., 42, 0) = -1 ENOTSOCK (Socket operation on non-socket)
oldselect(1, [0], NULL, NULL, {300, 0} <unfinished ...>
Note that Exim seems blissfully unaware that its attempt at sending
has failed ! If I then type a response to the MAIL FROM anyway, it
continues ...
recv(0, 0xbfffe40c, 4095, 0) = -1 ENOTSOCK (Socket operation on non-socket)
...
and writes to the logfile:
1998-03-25 21:42:32 0yHxrt-000053-00 == ian@??? T=smtp defe
r (88): Socket operation on non-socket: host davenant.davenant.greenend.org.uk [
172.18.45.1]: Socket operation on non-socket
Does it make the same mistake with message body text ?! (At least a
failed `send' on a RCPT command will just cause a hung SMTP
connection.)
How many other places in the Exim source code are the return values
from system calls not checked ?! I have to say that I think this kind
of thing is completely unacceptable in a program not written by
tripped-out BSD hackers ...
On an aside, is there any reason why you're using send() here instead
of write ? It seems to me that the error behaviour of send() is
unhelpful if you want to use non-blocking I/O (as you seem to), given
the use of select(). In particular, it seems to want to send the data
all at once, so it seems that you could loop with send returning
EWOULDBLOCK but select returning ready-for-writing.
Also, I can think of weird things that could be done with -MC which
would be harder if you have to make sure that the descriptor can be
used with send() rather than just write().
Ian.
--
*** Exim information can be found at
http://www.exim.org/ ***