Noticed this since an ldapd ran out of memory and the error printed by
the callback is just not helpful. So lets try to improve this.

I think errno is not clobbered so log_warn() should work and then also add
an indication if it is read or write.
-- 
:wq Claudio

Index: conn.c
===================================================================
RCS file: /cvs/src/usr.sbin/ldapd/conn.c,v
retrieving revision 1.20
diff -u -p -r1.20 conn.c
--- conn.c      30 Apr 2023 23:49:14 -0000      1.20
+++ conn.c      26 Jun 2023 09:07:53 -0000
@@ -242,7 +242,8 @@ conn_err(struct bufferevent *bev, short 
        else if ((why & EVBUFFER_TIMEOUT) == EVBUFFER_TIMEOUT)
                log_debug("timeout on connection %d", conn->fd);
        else
-               log_warnx("error 0x%02X on connection %d", why, conn->fd);
+               log_warn("%s error on connection %d",
+                   why & EVBUFFER_WRITE ? "write" : "read", conn->fd);
 
        conn_close(conn);
 }

Reply via email to