summaryrefslogtreecommitdiff
path: root/src/server/clientrules.c
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2021-07-23 23:12:57 +0000
committerLaurent Bercot <ska@appnovation.com>2021-07-23 23:12:57 +0000
commitd4b826cce5774ded3b859d9a9e1735c25bca50fb (patch)
tree413a7031ab5350cc3cf600f95ae80060e3030cfa /src/server/clientrules.c
parent02486d457def273db80d36c2370fd663511cb82b (diff)
downloads6-rc-d4b826cce5774ded3b859d9a9e1735c25bca50fb.tar.xz
Better cdb management; deps_wanted_closure mostly done
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'src/server/clientrules.c')
-rw-r--r--src/server/clientrules.c20
1 files changed, 4 insertions, 16 deletions
diff --git a/src/server/clientrules.c b/src/server/clientrules.c
index 4050b2f..6c930d8 100644
--- a/src/server/clientrules.c
+++ b/src/server/clientrules.c
@@ -17,8 +17,7 @@
static unsigned int rulestype = 0 ;
static char const *rules = 0 ;
-static int cdbfd = -1 ;
-static struct cdb cdbmap = CDB_ZERO ;
+static cdb cdbmap = CDB_ZERO ;
void clientrules_init (unsigned int type, char const *s)
{
@@ -26,28 +25,17 @@ void clientrules_init (unsigned int type, char const *s)
rules = s ;
if (rulestype == 2)
{
- cdbfd = open_readb(rules) ;
- if (cdbfd < 0) strerr_diefu3sys(111, "open ", rules, " for reading") ;
- if (cdb_init(&cdbmap, cdbfd) < 0)
+ if (!cdb_init(&cdbmap, rules))
strerr_diefu2sys(111, "cdb_init ", rules) ;
}
}
void clientrules_reload ()
{
- int fd ;
- struct cdb c = CDB_ZERO ;
+ cdb c = CDB_ZERO ;
if (rulestype != 2) break ;
- fd = open_readb(rules) ;
- if (fd < 0) break ;
- if (cdb_init(&c, fd) < 0)
- {
- fd_close(fd) ;
- break ;
- }
+ if (!cdb_init(&c, rules)) break ;
cdb_free(&cdbmap) ;
- fd_close(cdbfd) ;
- cdbfd = fd ;
cdbmap = c ;
}