summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2010-09-29 20:10:35 -0400
committerAdam <Adam@anope.org>2010-09-29 20:10:35 -0400
commitcb975f4a6c9199179ee8b0e6aec2c0951856709d (patch)
tree5c23fb49ae787ff115128895878cf2b1a7fa12da
parent0383868a29b49defda92e56921189079448db6f5 (diff)
Properly handle being unable to open the SendMailPath when forking
-rw-r--r--src/mail.c11
1 files changed, 6 insertions, 5 deletions
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)