From 0f2b297697d2c5d0ab9ee71d51c2e47fb4508aba Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Mon, 13 Jun 2016 17:54:37 +0200 Subject: [PATCH] Fix rsync exit handling in create mode. The logic in handle_rsync_exit() is horribly broken in case dss is run in create mode and the rsync process terminates unsuccessfully. First we claim to restart rsync, which is wrong. Next we call the post-create hook despite the documentation says that this hook is only run on *successful* termination. Finally, we dereference a NULL pointer to print the path of the snapshot. Fortunately, all three issues are easy to fix by special casing create mode in handle_rsync_exit(). --- dss.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dss.c b/dss.c index bdbdd04..0bc8913 100644 --- a/dss.c +++ b/dss.c @@ -862,6 +862,10 @@ static int handle_rsync_exit(int status) if (es != 0 && es != 24) { DSS_WARNING_LOG(("rsync exit code %d, error count %d\n", es, ++num_consecutive_rsync_errors)); + if (conf.create_given) { + ret = -E_BAD_EXIT_CODE; + goto out; + } if (num_consecutive_rsync_errors > conf.max_rsync_errors_arg) { ret = -E_TOO_MANY_RSYNC_ERRORS; snapshot_creation_status = HS_READY; -- 2.39.2