diff options
author | 2018-12-27 14:41:45 +0000 | |
---|---|---|
committer | 2018-12-27 14:41:45 +0000 | |
commit | dd8a449bfef3869097ae273fb6038f7f99086079 (patch) | |
tree | 5398221738217abcf9291dfeba766c4e83b697e3 | |
parent | introduce dump() and add() table methods, only implemented for static tables. (diff) | |
download | wireguard-openbsd-dd8a449bfef3869097ae273fb6038f7f99086079.tar.xz wireguard-openbsd-dd8a449bfef3869097ae273fb6038f7f99086079.zip |
move the iterator variable in the private handle.
it is now correctly reset between updates.
ok gilles@
-rw-r--r-- | usr.sbin/smtpd/table_db.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/usr.sbin/smtpd/table_db.c b/usr.sbin/smtpd/table_db.c index add5dc0fd1a..fde3983eb3d 100644 --- a/usr.sbin/smtpd/table_db.c +++ b/usr.sbin/smtpd/table_db.c @@ -1,4 +1,4 @@ -/* $OpenBSD: table_db.c,v 1.18 2018/12/27 14:23:41 eric Exp $ */ +/* $OpenBSD: table_db.c,v 1.19 2018/12/27 14:41:45 eric Exp $ */ /* * Copyright (c) 2011 Gilles Chehade <gilles@poolp.org> @@ -79,6 +79,7 @@ struct dbhandle { DB *db; char pathname[PATH_MAX]; time_t mtime; + int iter; }; static int @@ -209,11 +210,11 @@ table_db_fetch(struct table *table, enum table_service service, char **dst) DBT dbd; int r; - if (table->t_iter == NULL) + if (handle->iter == 0) r = handle->db->seq(handle->db, &dbk, &dbd, R_FIRST); else r = handle->db->seq(handle->db, &dbk, &dbd, R_NEXT); - table->t_iter = handle->db; + handle->iter = 1; if (!r) { r = handle->db->seq(handle->db, &dbk, &dbd, R_FIRST); if (!r) |