summaryrefslogtreecommitdiff
path: root/usr.sbin/smtpd/smtp_session.c
diff options
context:
space:
mode:
authorGilles Chehade <gilles@cvs.openbsd.org>2009-05-31 18:34:49 +0000
committerGilles Chehade <gilles@cvs.openbsd.org>2009-05-31 18:34:49 +0000
commit56a9092e1314d2e35e0a15144c5959d90769c01c (patch)
tree12e4fa043c4e76ada1f035cf6b893709823be206 /usr.sbin/smtpd/smtp_session.c
parent9e549b6118ce4a33059dc512ba3b70a21f384d5a (diff)
when entering mta_connect() reset session fd to -1
when connect timesout and we close the fd, reset session fd to -1 in session_destroy(), only attempt to close session fd if != -1 fixes a fatal in session_destroy() which happened because we closed a fd after a timeout, but the session still assumed the fd to be opened.
Diffstat (limited to 'usr.sbin/smtpd/smtp_session.c')
-rw-r--r--usr.sbin/smtpd/smtp_session.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.sbin/smtpd/smtp_session.c b/usr.sbin/smtpd/smtp_session.c
index fe8a925932a..d8c37a86232 100644
--- a/usr.sbin/smtpd/smtp_session.c
+++ b/usr.sbin/smtpd/smtp_session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: smtp_session.c,v 1.103 2009/05/30 16:22:07 gilles Exp $ */
+/* $OpenBSD: smtp_session.c,v 1.104 2009/05/31 18:34:48 gilles Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -955,7 +955,7 @@ session_destroy(struct session *s)
if (s->s_bev != NULL)
bufferevent_free(s->s_bev);
- if (close(s->s_fd) == -1)
+ if (s->s_fd != -1 && close(s->s_fd) == -1)
fatal("session_destroy: close");
switch (smtpd_process) {