dovecot-2.2: dsync: Wait for remote command to finish before shu...
dovecot at dovecot.org
dovecot at dovecot.org
Thu Jan 10 14:00:29 EET 2013
details: http://hg.dovecot.org/dovecot-2.2/rev/68b7c9ce713b
changeset: 15634:68b7c9ce713b
user: Timo Sirainen <tss at iki.fi>
date: Thu Jan 10 14:00:10 2013 +0200
description:
dsync: Wait for remote command to finish before shutting down.
This makes sure that any error messages during deinit stage are logged. Also
non-zero exit codes are logged.
diffstat:
src/doveadm/dsync/doveadm-dsync.c | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
diffs (30 lines):
diff -r 4da6d4fa1892 -r 68b7c9ce713b src/doveadm/dsync/doveadm-dsync.c
--- a/src/doveadm/dsync/doveadm-dsync.c Thu Jan 10 13:56:59 2013 +0200
+++ b/src/doveadm/dsync/doveadm-dsync.c Thu Jan 10 14:00:10 2013 +0200
@@ -27,6 +27,7 @@
#include <stdlib.h>
#include <unistd.h>
#include <ctype.h>
+#include <sys/wait.h>
#define DSYNC_LOCK_FILENAME ".dovecot-sync.lock"
#define DSYNC_COMMON_GETOPT_ARGS "+adEfl:m:n:r:Rs:"
@@ -311,8 +312,18 @@
static void
cmd_dsync_run_remote(struct mail_user *user)
{
+ int status;
+
i_set_failure_prefix("dsync-local(%s): ", user->username);
io_loop_run(current_ioloop);
+
+ /* wait for the remote command to finish to see any final errors */
+ if (wait(&status) == -1)
+ i_error("wait() failed: %m");
+ else if (WIFSIGNALED(status))
+ i_error("Remote command died with signal %d", WTERMSIG(status));
+ else if (WIFEXITED(status) && WEXITSTATUS(status) != 0)
+ i_error("Remote command returned error %d", WEXITSTATUS(status));
}
static const char *const *
More information about the dovecot-cvs
mailing list