diff options
m--------- | grecs | 0 | ||||
-rw-r--r-- | src/cmdline.opt | 6 | ||||
-rw-r--r-- | src/config.c | 9 | ||||
-rw-r--r-- | src/nssync.c | 4 |
4 files changed, 13 insertions, 6 deletions
diff --git a/grecs b/grecs | |||
Subproject 6020d6243c7fdf657da768b3fb2efa1244665d5 | Subproject 3299cf1ccb1c596969fcfd91253e10d5482eacf | ||
diff --git a/src/cmdline.opt b/src/cmdline.opt index 221133e..23c6bcb 100644 --- a/src/cmdline.opt +++ b/src/cmdline.opt | |||
@@ -58,12 +58,18 @@ END | |||
58 | OPTION(config-file,c,FILE, | 58 | OPTION(config-file,c,FILE, |
59 | [<use FILE instead of the default configuration>]) | 59 | [<use FILE instead of the default configuration>]) |
60 | BEGIN | 60 | BEGIN |
61 | config_file = optarg; | 61 | config_file = optarg; |
62 | END | 62 | END |
63 | 63 | ||
64 | OPTION(pidfile,p,FILE, | ||
65 | [<write PID to FILE>]) | ||
66 | BEGIN | ||
67 | cli_pidfile = optarg; | ||
68 | END | ||
69 | |||
64 | OPTION(cron,,, | 70 | OPTION(cron,,, |
65 | [<run as a periodic cron job (default)>]) | 71 | [<run as a periodic cron job (default)>]) |
66 | BEGIN | 72 | BEGIN |
67 | server_mode = 0; | 73 | server_mode = 0; |
68 | END | 74 | END |
69 | 75 | ||
diff --git a/src/config.c b/src/config.c index 5ff9280..6ddb2ea 100644 --- a/src/config.c +++ b/src/config.c | |||
@@ -385,36 +385,33 @@ synclist_fixup() | |||
385 | return err; | 385 | return err; |
386 | } | 386 | } |
387 | 387 | ||
388 | void | 388 | void |
389 | config_parse() | 389 | config_parse() |
390 | { | 390 | { |
391 | int err = 0; | ||
392 | struct grecs_node *tree = grecs_parse(config_file); | 391 | struct grecs_node *tree = grecs_parse(config_file); |
393 | if (!tree) | 392 | if (!tree) |
394 | exit(EX_CONFIG); | 393 | exit(EX_CONFIG); |
395 | grecs_tree_reduce(tree, nssync_kw, GRECS_AGGR); | 394 | grecs_tree_reduce(tree, nssync_kw, GRECS_AGGR); |
396 | if (grecs_tree_process(tree, nssync_kw)) | 395 | if (grecs_tree_process(tree, nssync_kw)) |
397 | exit(EX_CONFIG); | 396 | exit(EX_CONFIG); |
398 | grecs_tree_free(tree); | 397 | grecs_tree_free(tree); |
399 | 398 | ||
400 | if (!synclist) { | 399 | if (!synclist) { |
401 | error("nothing to do!"); | 400 | error("nothing to do!"); |
402 | err = 1; | 401 | exit(EX_CONFIG); |
403 | } | 402 | } |
404 | 403 | ||
405 | if (synclist_fixup()) | 404 | if (synclist_fixup()) |
406 | err = 1; | 405 | exit(EX_CONFIG); |
407 | 406 | ||
408 | if (sql_host_fixup()) | 407 | if (sql_host_fixup()) |
409 | err = 1; | 408 | exit(EX_CONFIG); |
410 | 409 | ||
411 | source_named_conf(); | 410 | source_named_conf(); |
412 | 411 | ||
413 | if (err) | ||
414 | exit(EX_CONFIG); | ||
415 | if (lint_mode) | 412 | if (lint_mode) |
416 | exit(0); | 413 | exit(0); |
417 | if (!tempdir) { | 414 | if (!tempdir) { |
418 | tempdir = getenv("TMP"); | 415 | tempdir = getenv("TMP"); |
419 | if (!tempdir) | 416 | if (!tempdir) |
420 | tempdir = "/tmp"; | 417 | tempdir = "/tmp"; |
diff --git a/src/nssync.c b/src/nssync.c index d10ce05..8f4fad2 100644 --- a/src/nssync.c +++ b/src/nssync.c | |||
@@ -27,12 +27,13 @@ int lint_mode; | |||
27 | int dry_run_mode; | 27 | int dry_run_mode; |
28 | int preprocess_only; | 28 | int preprocess_only; |
29 | int debug_level; | 29 | int debug_level; |
30 | char *config_file = SYSCONFDIR "/nssync.conf"; | 30 | char *config_file = SYSCONFDIR "/nssync.conf"; |
31 | char *slave_status_file; | 31 | char *slave_status_file; |
32 | char *pidfile; | 32 | char *pidfile; |
33 | char *cli_pidfile; | ||
33 | int force; | 34 | int force; |
34 | char *tempdir; | 35 | char *tempdir; |
35 | char *reload_command = "/usr/sbin/rndc reload"; | 36 | char *reload_command = "/usr/sbin/rndc reload"; |
36 | struct json_value *error_list; | 37 | struct json_value *error_list; |
37 | struct json_value *changed_zones; | 38 | struct json_value *changed_zones; |
38 | int check_ns; | 39 | int check_ns; |
@@ -699,12 +700,15 @@ main(int argc, char **argv) | |||
699 | parse_options(argc, argv); | 700 | parse_options(argc, argv); |
700 | if (preprocess_only) | 701 | if (preprocess_only) |
701 | exit(grecs_preproc_run(config_file, grecs_preprocessor) ? | 702 | exit(grecs_preproc_run(config_file, grecs_preprocessor) ? |
702 | EX_CONFIG : 0); | 703 | EX_CONFIG : 0); |
703 | config_parse(); | 704 | config_parse(); |
704 | 705 | ||
706 | if (cli_pidfile) | ||
707 | pidfile = cli_pidfile; | ||
708 | |||
705 | check_pidfile(); | 709 | check_pidfile(); |
706 | 710 | ||
707 | if (check_ns) | 711 | if (check_ns) |
708 | get_host_addresses(); | 712 | get_host_addresses(); |
709 | 713 | ||
710 | if (server_mode) { | 714 | if (server_mode) { |