/** Needed by the post-create hook. */
static char *path_to_last_complete_snapshot;
/** \sa \ref snap.h for details. */
/** Needed by the post-create hook. */
static char *path_to_last_complete_snapshot;
/** \sa \ref snap.h for details. */
current_snapshot_creation_time = 0;
dss_get_snapshot_list(&sl);
FOR_EACH_SNAPSHOT(s, i, &sl) {
current_snapshot_creation_time = 0;
dss_get_snapshot_list(&sl);
FOR_EACH_SNAPSHOT(s, i, &sl) {
int ret, fds[3] = {0, 0, 0};
if (!conf.pre_create_hook_given) {
int ret, fds[3] = {0, 0, 0};
if (!conf.pre_create_hook_given) {
if (!WIFEXITED(status)) {
DSS_ERROR_LOG("rsync process %d died involuntary\n", (int)create_pid);
ret = -E_INVOLUNTARY_EXIT;
if (!WIFEXITED(status)) {
DSS_ERROR_LOG("rsync process %d died involuntary\n", (int)create_pid);
ret = -E_INVOLUNTARY_EXIT;
if (es == 13) { /* Errors with program diagnostics */
DSS_WARNING_LOG("rsync process %d returned %d -- restarting\n",
(int)create_pid, es);
if (es == 13) { /* Errors with program diagnostics */
DSS_WARNING_LOG("rsync process %d returned %d -- restarting\n",
(int)create_pid, es);
gettimeofday(&next_snapshot_time, NULL);
next_snapshot_time.tv_sec += 60;
ret = 1;
gettimeofday(&next_snapshot_time, NULL);
next_snapshot_time.tv_sec += 60;
ret = 1;
if (es != 0 && es != 23 && es != 24) {
DSS_ERROR_LOG("rsync process %d returned %d\n", (int)create_pid, es);
ret = -E_BAD_EXIT_CODE;
if (es != 0 && es != 23 && es != 24) {
DSS_ERROR_LOG("rsync process %d returned %d\n", (int)create_pid, es);
ret = -E_BAD_EXIT_CODE;
ret = dss_exec(&create_pid, argv[0], argv, fds);
if (ret < 0)
return ret;
ret = dss_exec(&create_pid, argv[0], argv, fds);
if (ret < 0)
return ret;
if (tv_diff(&next_snapshot_time, &now, NULL) > 0)
continue;
switch (snapshot_creation_status) {
if (tv_diff(&next_snapshot_time, &now, NULL) > 0)
continue;
switch (snapshot_creation_status) {
free_rsync_argv(rsync_argv);
create_rsync_argv(&rsync_argv, ¤t_snapshot_creation_time);
ret = create_snapshot(rsync_argv);
if (ret < 0)
goto out;
continue;
free_rsync_argv(rsync_argv);
create_rsync_argv(&rsync_argv, ¤t_snapshot_creation_time);
ret = create_snapshot(rsync_argv);
if (ret < 0)
goto out;
continue;