]> git.tuebingen.mpg.de Git - dss.git/blobdiff - dss.c
Merge commit 'fml/master'
[dss.git] / dss.c
diff --git a/dss.c b/dss.c
index f8a1e5132dfd3954bd2242b2f38d6deb384ffa9e..d57daba037ede4b406030c639a4c93f063fa7533 100644 (file)
--- a/dss.c
+++ b/dss.c
@@ -175,13 +175,13 @@ static void compute_next_snapshot_time(void)
        tmp.tv_sec = x;
        tmp.tv_usec = 0;
        ret = tv_diff(&unit_interval, &tmp, &diff); /* total sleep time per unit interval */
-       gettimeofday(&now, NULL);
-       if (ret < 0 || !s)
+       if (ret < 0 || !s) /* unit_interval < tmp or no snapshot */
                goto min_sleep;
        tv_divide(wanted, &diff, &tmp); /* sleep time betweeen two snapshots */
-       diff.tv_sec = s->completion_time;
+       diff.tv_sec = s->completion_time; /* completion time of the the latest snaphot */
        diff.tv_usec = 0;
        tv_add(&diff, &tmp, &next_snapshot_time);
+       gettimeofday(&now, NULL);
        if (tv_diff(&now, &next_snapshot_time, NULL) < 0)
                goto out;
 min_sleep:
@@ -380,8 +380,8 @@ static int post_create_hook(void)
                compute_next_snapshot_time();
                return 0;
        }
-       cmd = make_message("%s %s", conf.post_create_hook_arg,
-               path_to_last_complete_snapshot);
+       cmd = make_message("%s %s/%s", conf.post_create_hook_arg,
+               conf.dest_dir_arg, path_to_last_complete_snapshot);
        DSS_NOTICE_LOG("executing %s\n", cmd);
        ret = dss_exec_cmdline_pid(&post_create_hook_pid, cmd, fds);
        free(cmd);
@@ -620,6 +620,15 @@ static int parse_config_file(int override)
                        .check_ambiguity = 0,
                        .print_errors = 1
                };
+               if (override) { /* invalidate all rsync options */
+                       int i;
+
+                       for (i = 0; i < conf.rsync_option_given; i++) {
+                               free(conf.rsync_option_arg[i]);
+                               conf.rsync_option_arg[i] = NULL;
+                       }
+                       conf.rsync_option_given = 0;
+               }
                cmdline_parser_config_file(config_file, &conf, &params);
        }
        ret = check_config();