Need to flush early errors before we exit.
authorWayne Davison <wayne@opencoder.net>
Mon, 18 May 2020 03:21:45 +0000 (20:21 -0700)
committerWayne Davison <wayne@opencoder.net>
Mon, 18 May 2020 04:20:15 +0000 (21:20 -0700)
NEWS
clientserver.c
main.c
options.c

diff --git a/NEWS b/NEWS
index d2043baeef1053ca81a898b44373bd6d06d9223a..23b7f034dd1d64ed00dea36df06c98df49883ad3 100644 (file)
--- 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.
index 3970f507f610b8178a3787454bef8a8212c1d542..e5a631a399d374002e43b38e0478eb5d1b026e8a 100644 (file)
@@ -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 3b37796db91f0fd4895e472a263097b30de04c1a..ca96270a14c34f54b84afe747bdcefad2e5f28c1 100644 (file)
--- 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);
        }
index 66854ca0bc6c429a4515c7b043e6db9442213490..a66930064eb6463487cfff25280efbb33bccacaf 100644 (file)
--- 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);
 }