#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"
{
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);
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));
*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]);