From 45cf1594f717b07d27721e90d7afa7b7a1171424 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Sat, 8 Aug 2009 18:33:41 +0000 Subject: Make imsg_clear close and free any fds in the received fd queue as well as freeing the msgbuf. While here also remove an unnecessary while loop. ok eric pyr --- usr.sbin/relayd/imsg.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'usr.sbin/relayd') diff --git a/usr.sbin/relayd/imsg.c b/usr.sbin/relayd/imsg.c index aa39c209325..6f8474c15e5 100644 --- a/usr.sbin/relayd/imsg.c +++ b/usr.sbin/relayd/imsg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: imsg.c,v 1.28 2009/06/08 08:30:06 dlg Exp $ */ +/* $OpenBSD: imsg.c,v 1.29 2009/08/08 18:33:40 nicm Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer @@ -263,6 +263,9 @@ imsg_flush(struct imsgbuf *ibuf) void imsg_clear(struct imsgbuf *ibuf) { - while (ibuf->w.queued) - msgbuf_clear(&ibuf->w); + int fd; + + msgbuf_clear(&ibuf->w); + while ((fd = imsg_get_fd(ibuf)) != -1) + close(fd); } -- cgit v1.2.3