[comp.bugs.4bsd] sendmail reports "Bad file number"

e07@nikhefh.hep.nl (Eric Wassenaar) (11/20/88)

Every now and then there is some discussion about the "Bad file number"
status that sendmail reports in case an smtp transaction fails.
So far I have not read a satisfactory answer. I think this is:

In the routine smtpquit() in usersmtp.c there is a double fclose(SmtpIn)
and fclose(SmtpOut) which both refer to the same fileno (the socket).
The first one actually closes the socket, so the second one fails and
clobbers errno. The remedy is to save the current errno before the
double fclose() and restore it afterwards.

Eric Wassenaar
-- 
Organization: NIKHEF-H, National Institute for Nuclear and High-Energy Physics
Address: Kruislaan 409, P.O. Box 41882, 1009 DB Amsterdam, the Netherlands
Phone: +31 20 5920412   Home phone: +31 20 909449    Telex: 10262 (hef nl)
Internet: e07@nikhefh.hep.nl  Bitnet: nikhefh!e07@mcvax.bitnet