summaryrefslogtreecommitdiff
path: root/src/fdholder/s6-fdholderd.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/fdholder/s6-fdholderd.c')
-rw-r--r--src/fdholder/s6-fdholderd.c20
1 files changed, 4 insertions, 16 deletions
diff --git a/src/fdholder/s6-fdholderd.c b/src/fdholder/s6-fdholderd.c
index bacd42c..1300640 100644
--- a/src/fdholder/s6-fdholderd.c
+++ b/src/fdholder/s6-fdholderd.c
@@ -47,8 +47,7 @@ static tain_t const nano1 = { .sec = TAI_ZERO, .nano = 1 } ;
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 ;
static void handle_signals (void)
{
@@ -67,19 +66,10 @@ static void handle_signals (void)
}
case SIGHUP :
{
- 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 ;
}
break ;
@@ -723,9 +713,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
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) ;
}