dss.c: Add missing inclusion of <stdio.h>.
[dss.git] / dss.c
diff --git a/dss.c b/dss.c
index a50a3dedd9235274ae380ad6272279ba8ba6ada8..03ddaf89c1493c10bef79e7c0f36c9180d2410e5 100644 (file)
--- a/dss.c
+++ b/dss.c
@@ -5,12 +5,14 @@
  */
 #include <string.h>
 #include <stdlib.h>
  */
 #include <string.h>
 #include <stdlib.h>
+#include <stdio.h>
 #include <stdarg.h>
 #include <assert.h>
 #include <errno.h>
 #include <sys/types.h>
 #include <signal.h>
 #include <ctype.h>
 #include <stdarg.h>
 #include <assert.h>
 #include <errno.h>
 #include <sys/types.h>
 #include <signal.h>
 #include <ctype.h>
+#include <stdbool.h>
 #include <sys/stat.h>
 #include <unistd.h>
 #include <inttypes.h>
 #include <sys/stat.h>
 #include <unistd.h>
 #include <inttypes.h>
@@ -977,7 +979,7 @@ static int check_config(void)
  * Returns < 0 on errors, 0 if no config file is given and > 0 if the config
  * file was read successfully.
  */
  * Returns < 0 on errors, 0 if no config file is given and > 0 if the config
  * file was read successfully.
  */
-static int parse_config_file(int override)
+static int parse_config_file(bool sighup)
 {
        int ret, config_file_exists;
        char *config_file = get_config_file_name();
 {
        int ret, config_file_exists;
        char *config_file = get_config_file_name();
@@ -985,7 +987,7 @@ static int parse_config_file(int override)
        char *old_logfile_arg = NULL;
        int old_daemon_given = 0;
 
        char *old_logfile_arg = NULL;
        int old_daemon_given = 0;
 
-       if (override) { /* SIGHUP */
+       if (sighup) {
                if (conf.logfile_given)
                        old_logfile_arg = dss_strdup(conf.logfile_arg);
                old_daemon_given = conf.daemon_given;
                if (conf.logfile_given)
                        old_logfile_arg = dss_strdup(conf.logfile_arg);
                old_daemon_given = conf.daemon_given;
@@ -999,12 +1001,12 @@ static int parse_config_file(int override)
        }
        if (config_file_exists) {
                struct cmdline_parser_params params;
        }
        if (config_file_exists) {
                struct cmdline_parser_params params;
-               params.override = override;
+               params.override = sighup;
                params.initialize = 0;
                params.check_required = 1;
                params.check_ambiguity = 0;
                params.print_errors = 1;
                params.initialize = 0;
                params.check_required = 1;
                params.check_ambiguity = 0;
                params.print_errors = 1;
-               if (override) { /* invalidate all rsync options */
+               if (sighup) { /* invalidate all rsync options */
                        int i;
 
                        for (i = 0; i < conf.rsync_option_given; i++) {
                        int i;
 
                        for (i = 0; i < conf.rsync_option_given; i++) {
@@ -1018,7 +1020,7 @@ static int parse_config_file(int override)
        ret = check_config();
        if (ret < 0)
                goto out;
        ret = check_config();
        if (ret < 0)
                goto out;
-       if (override) {
+       if (sighup) {
                /* don't change daemon mode on SIGHUP */
                conf.daemon_given = old_daemon_given;
                close_log(logfile);
                /* don't change daemon mode on SIGHUP */
                conf.daemon_given = old_daemon_given;
                close_log(logfile);
@@ -1055,7 +1057,7 @@ static int handle_sighup(void)
 
        DSS_NOTICE_LOG(("SIGHUP, re-reading config\n"));
        dump_dss_config("old");
 
        DSS_NOTICE_LOG(("SIGHUP, re-reading config\n"));
        dump_dss_config("old");
-       ret = parse_config_file(1);
+       ret = parse_config_file(true /* SIGHUP */);
        if (ret < 0)
                return ret;
        dump_dss_config("reloaded");
        if (ret < 0)
                return ret;
        dump_dss_config("reloaded");
@@ -1506,6 +1508,7 @@ int main(int argc, char **argv)
 
        cmdline_parser_ext(argc, argv, &conf, &params); /* aborts on errors */
        ret = parse_config_file(0);
 
        cmdline_parser_ext(argc, argv, &conf, &params); /* aborts on errors */
        ret = parse_config_file(0);
+       ret = parse_config_file(false /* no SIGHUP */);
        if (ret < 0)
                goto out;
        if (ret == 0) { /* no config file given */
        if (ret < 0)
                goto out;
        if (ret == 0) { /* no config file given */