From: reyk Date: Mon, 19 Oct 2015 09:17:23 +0000 (+0000) Subject: Print control socket client fd in debug message to differentiate between X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=91441f74148db1f5abb5cc0424b36f9cea46a9f9;p=openbsd Print control socket client fd in debug message to differentiate between control connections. Helps to debug problems. --- diff --git a/usr.sbin/snmpd/control.c b/usr.sbin/snmpd/control.c index 79d84257b80..56233faaa73 100644 --- a/usr.sbin/snmpd/control.c +++ b/usr.sbin/snmpd/control.c @@ -1,4 +1,4 @@ -/* $OpenBSD: control.c,v 1.31 2015/10/17 10:20:33 reyk Exp $ */ +/* $OpenBSD: control.c,v 1.32 2015/10/19 09:17:23 reyk Exp $ */ /* * Copyright (c) 2010-2013 Reyk Floeter @@ -173,8 +173,8 @@ control_accept(int listenfd, short event, void *arg) socket_set_blockmode(connfd, BM_NONBLOCK); if ((c = calloc(1, sizeof(struct ctl_conn))) == NULL) { - log_warn("%s", __func__); close(connfd); + log_warn("%s: calloc", __func__); return; } @@ -207,11 +207,11 @@ control_close(struct ctl_conn *c, const char *msg, struct imsg *imsg) struct control_sock *cs = c->cs; if (imsg) { - log_debug("%s: %s, imsg %d datalen %u", __func__, msg, - imsg->hdr.type, IMSG_DATA_SIZE(imsg)); + log_debug("%s: fd %d: %s, imsg %d datalen %u", __func__, + c->iev.ibuf.fd, msg, imsg->hdr.type, IMSG_DATA_SIZE(imsg)); imsg_free(imsg); } else - log_debug("%s: %s", __func__, msg); + log_debug("%s: fd %d: %s", __func__, c->iev.ibuf.fd, msg); msgbuf_clear(&c->iev.ibuf.w); TAILQ_REMOVE(&ctl_conns, c, entry);