rsync: Remove hardcoded --quiet option.
[dss.git] / dss.c
diff --git a/dss.c b/dss.c
index 4202d08da8c0eeee0a567da6db239a5865beed6b..813d73dc11204a2a4a6989c89e23f469db049680 100644 (file)
--- a/dss.c
+++ b/dss.c
 #include "gcc-compat.h"
 #include "cmdline.h"
 #include "log.h"
-#include "string.h"
-#include "error.h"
-#include "fd.h"
+#include "str.h"
+#include "err.h"
+#include "file.h"
 #include "exec.h"
 #include "daemon.h"
-#include "signal.h"
+#include "sig.h"
 #include "df.h"
-#include "time.h"
+#include "tv.h"
 #include "snap.h"
 #include "ipc.h"
 
@@ -548,10 +548,17 @@ static int rename_incomplete_snapshot(int64_t start)
 {
        char *old_name;
        int ret;
+       int64_t now;
 
+       /*
+        * We don't want the dss_rename() below to fail with EEXIST because the
+        * last complete snapshot was created (and completed) in the same
+        * second as this one.
+        */
+       while ((now = get_current_time()) == start)
+               sleep(1);
        free(path_to_last_complete_snapshot);
-       ret = complete_name(start, get_current_time(),
-               &path_to_last_complete_snapshot);
+       ret = complete_name(start, now, &path_to_last_complete_snapshot);
        if (ret < 0)
                return ret;
        old_name = incomplete_name(start);
@@ -932,8 +939,9 @@ static int check_config(void)
                return -E_INVALID_NUMBER;
        }
        DSS_DEBUG_LOG(("unit interval: %i day(s)\n", conf.unit_interval_arg));
-       if (conf.num_intervals_arg <= 0) {
-               DSS_ERROR_LOG(("bad number of intervals  %i\n", conf.num_intervals_arg));
+       if (conf.num_intervals_arg <= 0 || conf.num_intervals_arg > 30) {
+               DSS_ERROR_LOG(("bad number of intervals: %i\n",
+                       conf.num_intervals_arg));
                return -E_INVALID_NUMBER;
        }
        DSS_DEBUG_LOG(("number of intervals: %i\n", conf.num_intervals_arg));
@@ -1140,7 +1148,7 @@ static void create_rsync_argv(char ***argv, int64_t *num)
 
        *argv = dss_malloc((15 + conf.rsync_option_given) * sizeof(char *));
        (*argv)[i++] = dss_strdup("rsync");
-       (*argv)[i++] = dss_strdup("-aq");
+       (*argv)[i++] = dss_strdup("-a");
        (*argv)[i++] = dss_strdup("--delete");
        for (j = 0; j < conf.rsync_option_given; j++)
                (*argv)[i++] = dss_strdup(conf.rsync_option_arg[j]);