diff options
author | 2012-08-19 10:28:28 +0000 | |
---|---|---|
committer | 2012-08-19 10:28:28 +0000 | |
commit | 9013f127b4b028adcfdb9c7e424a6aefd4c14fed (patch) | |
tree | 9781c324c181c50c820caa6a20a623c644722473 | |
parent | add missing IMSG_* in imsg_to_str() (diff) | |
download | wireguard-openbsd-9013f127b4b028adcfdb9c7e424a6aefd4c14fed.tar.xz wireguard-openbsd-9013f127b4b028adcfdb9c7e424a6aefd4c14fed.zip |
Add warnings on io errors to help diagnosis.
ok gilles@ chl@
-rw-r--r-- | usr.sbin/smtpd/ioev.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/usr.sbin/smtpd/ioev.c b/usr.sbin/smtpd/ioev.c index 2e9521a06f2..2345a256ef2 100644 --- a/usr.sbin/smtpd/ioev.c +++ b/usr.sbin/smtpd/ioev.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ioev.c,v 1.3 2012/05/25 13:52:33 chl Exp $ */ +/* $OpenBSD: ioev.c,v 1.4 2012/08/19 10:28:28 eric Exp $ */ /* * Copyright (c) 2012 Eric Faurot <eric@openbsd.org> * @@ -28,6 +28,7 @@ #include <stdio.h> #include <unistd.h> +#include "log.h" #include "ioev.h" #include "iobuf.h" @@ -523,8 +524,10 @@ io_dispatch(int fd, short ev, void *humppa) if (ev & EV_WRITE && (w = io_queued(io))) { if ((n = iobuf_write(io->iobuf, io->sock)) < 0) { + if (n == IO_ERROR) + log_warn("io_dispatch: iobuf_write"); io_callback(io, n == IOBUF_CLOSED ? - IO_DISCONNECTED : IO_ERROR); + IO_DISCONNECTED : IO_ERROR); goto leave; } if (w > io->lowat && w - n <= io->lowat) @@ -533,6 +536,8 @@ io_dispatch(int fd, short ev, void *humppa) if (ev & EV_READ) { if ((n = iobuf_read(io->iobuf, io->sock)) < 0) { + if (n == IO_ERROR) + log_warn("io_dispatch: iobuf_read"); io_callback(io, n == IOBUF_CLOSED ? IO_DISCONNECTED : IO_ERROR); goto leave; @@ -695,6 +700,7 @@ io_dispatch_connect_ssl(int fd, short event, void *humppa) io_reset(io, EV_WRITE, io_dispatch_connect_ssl); break; default: + ssl_error("io_dispatch_connect_ssl:SSL_connect"); io_callback(io, IO_ERROR); break; } @@ -727,6 +733,7 @@ io_dispatch_read_ssl(int fd, short event, void *humppa) io_callback(io, IO_DISCONNECTED); break; case IOBUF_ERROR: + ssl_error("io_dispatch_read_ssl:SSL_read"); io_callback(io, IO_ERROR); break; default: @@ -764,6 +771,7 @@ io_dispatch_write_ssl(int fd, short event, void *humppa) io_callback(io, IO_DISCONNECTED); break; case IOBUF_ERROR: + ssl_error("io_dispatch_write_ssl:SSL_write"); io_callback(io, IO_ERROR); break; default: |