Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!samsung!uunet!mcsun!hp4nl!nikhefh!e07 From: e07@nikhefh.nikhef.nl (Eric Wassenaar) Newsgroups: comp.mail.sendmail Subject: Re: Bad File Number Message-ID: <1034@nikhefh.nikhef.nl> Date: 4 Nov 90 23:18:16 GMT References: <599@fsucs.UUCP> Sender: e07@nikhef.nl (Eric Wassenaar) Organization: Nikhef-H, Amsterdam (the Netherlands). Lines: 32 levitz@fsucs.UUCP (Hilbert Levitz) writes: > ... > During the mail passing stage of the SMTP dialog if connection > breaks off, the mail goes on the queue with the error message > "Bad File Number". From this there is no automatic recovery. The item > ... This bug has been solved since version 5.64. If you have an older version, proceed as follows: In the module smtpquit() in usersmtp.c you find the code (void) fclose(SmtpIn); (void) fclose(SmtpOut); which actually closes the same (socket) fileno twice. The second fclose sets errno to EBADF. The solution is to change in makeconnection() in daemon.c the line *infile = fdopen(s, "r"); to *infile = fdopen(dup(s), "r"); Another solution is to save errno before the first fclose, and to restore it after the second fclose in smtpquit(). 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 592 0412, Home: +31 20 909449, Telefax: +31 20 592 5155 Internet: e07@nikhef.nl