Skip to content

Commit b059bcd

Browse files
committed
Close connections on failure
1 parent 1b41273 commit b059bcd

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

net.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -372,11 +372,13 @@ deliver_to_host(struct qitem *it, struct mx_hostentry *host)
372372
host->host, host->addr, c, neterr); \
373373
snprintf(errmsg, sizeof(errmsg), "%s [%s] did not like our %s:\n%s", \
374374
host->host, host->addr, c, neterr); \
375-
return (-1); \
375+
error = -1; \
376+
goto out; \
376377
} else if (res != exp) { \
377378
syslog(LOG_NOTICE, "remote delivery deferred: %s [%s] failed after %s: %s", \
378379
host->host, host->addr, c, neterr); \
379-
return (1); \
380+
error = 1; \
381+
goto out; \
380382
}
381383

382384
/* Check first reply from remote host */
@@ -426,7 +428,8 @@ deliver_to_host(struct qitem *it, struct mx_hostentry *host)
426428
syslog(LOG_ERR, "remote delivery failed:"
427429
" SMTP login failed: %m");
428430
snprintf(errmsg, sizeof(errmsg), "SMTP login to %s failed", host->host);
429-
return (-1);
431+
error = -1;
432+
goto out;
430433
}
431434
/* SMTP login is not available, so try without */
432435
else if (error > 0) {

0 commit comments

Comments
 (0)