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);
return ret;
}
+/*
+ * We can not use rsync locally if the local user is different from the remote
+ * user or if the src dir is not on the local host (or both).
+ */
+static int use_rsync_locally(char *logname)
+{
+ char *h = conf.remote_host_arg;
+
+ if (strcmp(h, "localhost") && strcmp(h, "127.0.0.1"))
+ return 0;
+ if (conf.remote_user_given && strcmp(conf.remote_user_arg, logname))
+ return 0;
+ return 1;
+}
+
static void create_rsync_argv(char ***argv, int64_t *num)
{
char *logname, *newest;
} else
DSS_INFO_LOG("no previous snapshot found\n");
logname = dss_logname();
- if (conf.remote_user_given && !strcmp(conf.remote_user_arg, logname))
+ if (use_rsync_locally(logname))
(*argv)[i++] = dss_strdup(conf.source_dir_arg);
else
(*argv)[i++] = make_message("%s@%s:%s/", conf.remote_user_given?