From e448d31d6386ddb7686a83cbc85457e5f78cdb34 Mon Sep 17 00:00:00 2001 From: Wayne Davison Date: Sun, 17 May 2020 20:21:45 -0700 Subject: [PATCH] Need to flush early errors before we exit. --- NEWS | 3 +++ clientserver.c | 1 + main.c | 2 -- options.c | 1 + 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index d2043bae..23b7f034 100644 --- a/NEWS +++ b/NEWS @@ -24,6 +24,9 @@ Changes since 3.1.3: - Fixed an issue with --remove-source-files not removing a source symlink when combined with --copy-links. + - Fixed a bug where the daemon would fail to write early fatal error + messages to the client, such as refused or unknown command-line options. + - Fixed the block-size validation logic when dealing with older protocols. - Some rrsync fixes and enhancements to handle the latest options. diff --git a/clientserver.c b/clientserver.c index 3970f507..e5a631a3 100644 --- a/clientserver.c +++ b/clientserver.c @@ -965,6 +965,7 @@ static int rsync_module(int f_in, int f_out, int i, const char *addr, const char } if (*err_msg) rprintf(FERROR, "%s\n", err_msg); + io_flush(FULL_FLUSH); } else option_error(); msleep(400); diff --git a/main.c b/main.c index 3b37796d..ca96270a 100644 --- a/main.c +++ b/main.c @@ -1700,8 +1700,6 @@ int main(int argc,char *argv[]) #endif if (!parse_arguments(&argc, (const char ***) &argv)) { - /* FIXME: We ought to call the same error-handling - * code here, rather than relying on getopt. */ option_error(); exit_cleanup(RERR_SYNTAX); } diff --git a/options.c b/options.c index 66854ca0..a6693006 100644 --- a/options.c +++ b/options.c @@ -1138,6 +1138,7 @@ void option_error(void) } rprintf(FERROR, RSYNC_NAME ": %s", err_buf); + io_flush(FULL_FLUSH); msleep(20); } -- 2.34.1