Browse Source

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
OPENBSD_4_7
nicm 15 years ago
parent
commit
1ce69afa27
1 changed files with 6 additions and 3 deletions
  1. +6
    -3
      src/usr.sbin/ntpd/imsg.c

+ 6
- 3
src/usr.sbin/ntpd/imsg.c View File

@ -1,4 +1,4 @@
/* $OpenBSD: imsg.c,v 1.17 2009/06/08 08:30:06 dlg Exp $ */
/* $OpenBSD: imsg.c,v 1.18 2009/08/08 18:33:40 nicm Exp $ */
/* /*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@ -263,6 +263,9 @@ imsg_flush(struct imsgbuf *ibuf)
void void
imsg_clear(struct imsgbuf *ibuf) 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);
} }

Loading…
Cancel
Save