From cb975f4a6c9199179ee8b0e6aec2c0951856709d Mon Sep 17 00:00:00 2001 From: Adam Date: Wed, 29 Sep 2010 20:10:35 -0400 Subject: Properly handle being unable to open the SendMailPath when forking --- src/mail.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/mail.c b/src/mail.c index 1f092ebc1..6eb0d9839 100644 --- a/src/mail.c +++ b/src/mail.c @@ -228,14 +228,15 @@ void MailEnd(MailInfo * mail) fclose(mail->writepipe); fd = popen(SendMailPath, "w"); - if (!fd) - return; - while ((ret = fgetc(mail->readpipe)) != 255) - fputc(ret, fd); + if (fd) + { + while ((ret = fgetc(mail->readpipe)) != 255) + fputc(ret, fd); + pclose(fd); + } fclose(mail->readpipe); - pclose(fd); exit(EXIT_SUCCESS); } else if (pid < 0) -- cgit