From 2cec73c97140588cadad597391be6c13ee0ab2da Mon Sep 17 00:00:00 2001 From: Sergey Poznyakoff Date: Wed, 15 Nov 2017 11:17:36 +0200 Subject: Bugfixes * grecs: Update. * src/cmdline.opt: New option --pidfile * src/nssync.c: Pidfile from command line overrides that from configuration. * src/config.c (config_parse): Fix coredump on empty synclist --- grecs | 2 +- src/cmdline.opt | 6 ++++++ src/config.c | 9 +++------ src/nssync.c | 4 ++++ 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/grecs b/grecs index 6020d62..3299cf1 160000 --- a/grecs +++ b/grecs @@ -1 +1 @@ -Subproject commit 6020d6243c7fdf657da768b3fb2efa1244665d51 +Subproject commit 3299cf1ccb1c596969fcfd91253e10d5482eacf9 diff --git a/src/cmdline.opt b/src/cmdline.opt index 221133e..23c6bcb 100644 --- a/src/cmdline.opt +++ b/src/cmdline.opt @@ -61,6 +61,12 @@ BEGIN config_file = optarg; END +OPTION(pidfile,p,FILE, + []) +BEGIN + cli_pidfile = optarg; +END + OPTION(cron,,, []) BEGIN diff --git a/src/config.c b/src/config.c index 5ff9280..6ddb2ea 100644 --- a/src/config.c +++ b/src/config.c @@ -388,7 +388,6 @@ synclist_fixup() void config_parse() { - int err = 0; struct grecs_node *tree = grecs_parse(config_file); if (!tree) exit(EX_CONFIG); @@ -399,19 +398,17 @@ config_parse() if (!synclist) { error("nothing to do!"); - err = 1; + exit(EX_CONFIG); } if (synclist_fixup()) - err = 1; + exit(EX_CONFIG); if (sql_host_fixup()) - err = 1; + exit(EX_CONFIG); source_named_conf(); - if (err) - exit(EX_CONFIG); if (lint_mode) exit(0); if (!tempdir) { diff --git a/src/nssync.c b/src/nssync.c index d10ce05..8f4fad2 100644 --- a/src/nssync.c +++ b/src/nssync.c @@ -30,6 +30,7 @@ int debug_level; char *config_file = SYSCONFDIR "/nssync.conf"; char *slave_status_file; char *pidfile; +char *cli_pidfile; int force; char *tempdir; char *reload_command = "/usr/sbin/rndc reload"; @@ -702,6 +703,9 @@ main(int argc, char **argv) EX_CONFIG : 0); config_parse(); + if (cli_pidfile) + pidfile = cli_pidfile; + check_pidfile(); if (check_ns) -- cgit v1.2.1