Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/npf/npfctl npfctl: need to rewind the list after ca...
details: https://anonhg.NetBSD.org/src/rev/a84df440a0a6
branches: trunk
changeset: 791538:a84df440a0a6
user: rmind <rmind%NetBSD.org@localhost>
date: Fri Nov 22 18:42:02 2013 +0000
description:
npfctl: need to rewind the list after calling print_table(). XXX libnpf.
diffstat:
usr.sbin/npf/npfctl/npf_show.c | 13 +++++++------
1 files changed, 7 insertions(+), 6 deletions(-)
diffs (39 lines):
diff -r a46458021119 -r a84df440a0a6 usr.sbin/npf/npfctl/npf_show.c
--- a/usr.sbin/npf/npfctl/npf_show.c Fri Nov 22 17:19:14 2013 +0000
+++ b/usr.sbin/npf/npfctl/npf_show.c Fri Nov 22 18:42:02 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: npf_show.c,v 1.7 2013/11/22 00:25:51 rmind Exp $ */
+/* $NetBSD: npf_show.c,v 1.8 2013/11/22 18:42:02 rmind Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: npf_show.c,v 1.7 2013/11/22 00:25:51 rmind Exp $");
+__RCSID("$NetBSD: npf_show.c,v 1.8 2013/11/22 18:42:02 rmind Exp $");
#include <sys/socket.h>
#include <netinet/in.h>
@@ -155,15 +155,16 @@
{
unsigned tid = words[0];
nl_table_t *tl;
- char *p;
+ char *p = NULL;
+ /* XXX: Iterating all as we need to rewind for the next call. */
while ((tl = npf_table_iterate(ctx->conf)) != NULL) {
- if (npf_table_getid(tl) == tid) {
+ if (!p && npf_table_getid(tl) == tid) {
easprintf(&p, "%s", npf_table_getname(tl));
- return p;
}
}
- abort();
+ assert(p != NULL);
+ return p;
}
static char *
Home |
Main Index |
Thread Index |
Old Index