summaryrefslogtreecommitdiffstats
path: root/contrib/sendmail/src
diff options
context:
space:
mode:
authorgshapiro <gshapiro@FreeBSD.org>2005-02-14 08:04:08 +0000
committergshapiro <gshapiro@FreeBSD.org>2005-02-14 08:04:08 +0000
commit939f1dec3d5c099d697f9b51b5b2f4a1ab4dbbdb (patch)
tree6219b4cfa01fcc12d027f0a1708d3b8579191d3b /contrib/sendmail/src
parentd2ebfe4c1f1998f4bd2184a39cb19cc7ec023001 (diff)
downloadFreeBSD-src-939f1dec3d5c099d697f9b51b5b2f4a1ab4dbbdb.zip
FreeBSD-src-939f1dec3d5c099d697f9b51b5b2f4a1ab4dbbdb.tar.gz
Merge mci.c change to add mci_close() from the vendor branch.
Problem noted by: marcus
Diffstat (limited to 'contrib/sendmail/src')
-rw-r--r--contrib/sendmail/src/mci.c51
1 files changed, 51 insertions, 0 deletions
diff --git a/contrib/sendmail/src/mci.c b/contrib/sendmail/src/mci.c
index 894c302..095700b 100644
--- a/contrib/sendmail/src/mci.c
+++ b/contrib/sendmail/src/mci.c
@@ -399,6 +399,57 @@ mci_get(host, m)
return mci;
}
+
+/*
+** MCI_CLOSE -- (forcefully) close files used for a connection.
+** Note: this is a last resort, usually smtpquit() or endmailer()
+** should be used to close a connection.
+**
+** Parameters:
+** mci -- the connection to close.
+** where -- where has this been called?
+**
+** Returns:
+** none.
+*/
+
+void
+mci_close(mci, where)
+ MCI *mci;
+ char *where;
+{
+ bool dumped;
+
+ if (mci == NULL)
+ return;
+ dumped = false;
+ if (mci->mci_out != NULL)
+ {
+ if (tTd(56, 1))
+ {
+ sm_dprintf("mci_close: mci_out!=NULL, where=%s\n",
+ where);
+ mci_dump(sm_debug_file(), mci, false);
+ dumped = true;
+ }
+ (void) sm_io_close(mci->mci_out, SM_TIME_DEFAULT);
+ mci->mci_out = NULL;
+ }
+ if (mci->mci_in != NULL)
+ {
+ if (tTd(56, 1))
+ {
+ sm_dprintf("mci_close: mci_in!=NULL, where=%s\n",
+ where);
+ if (!dumped)
+ mci_dump(sm_debug_file(), mci, false);
+ }
+ (void) sm_io_close(mci->mci_in, SM_TIME_DEFAULT);
+ mci->mci_in = NULL;
+ }
+ mci->mci_state = MCIS_CLOSED;
+}
+
/*
** MCI_NEW -- allocate new MCI structure
**
OpenPOWER on IntegriCloud