summaryrefslogtreecommitdiff
path: root/options.c
diff options
context:
space:
mode:
authorWayne Davison <wayne@opencoder.net>2020-07-23 10:36:49 -0700
committerWayne Davison <wayne@opencoder.net>2020-07-23 11:23:47 -0700
commit592059c8fd88fbb08f69554bf3176626c7ee7554 (patch)
tree1555c38585e3b476522e08f9d52f4788bf063e1d /options.c
parent37f4a23f609f8be7e60753bfcd1ab3b4cf94714e (diff)
downloadrsync-592059c8fd88fbb08f69554bf3176626c7ee7554.tar.gz
Improve error output for local & remote-shell xfers
Diffstat (limited to 'options.c')
-rw-r--r--options.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/options.c b/options.c
index 59335269..ecd1a1f7 100644
--- a/options.c
+++ b/options.c
@@ -91,7 +91,7 @@ int relative_paths = -1;
int implied_dirs = 1;
int missing_args = 0; /* 0 = FERROR_XFER, 1 = ignore, 2 = delete */
int numeric_ids = 0;
-int msgs2stderr = 0;
+int msgs2stderr = -1;
int allow_8bit_chars = 0;
int force_delete = 0;
int io_timeout = 0;
@@ -803,7 +803,7 @@ static struct poptOption long_options[] = {
{"no-v", 0, POPT_ARG_VAL, &verbose, 0, 0, 0 },
{"info", 0, POPT_ARG_STRING, 0, OPT_INFO, 0, 0 },
{"debug", 0, POPT_ARG_STRING, 0, OPT_DEBUG, 0, 0 },
- {"msgs2stderr", 0, POPT_ARG_NONE, &msgs2stderr, 0, 0, 0 },
+ {"msgs2stderr", 0, POPT_ARG_VAL, &msgs2stderr, 1, 0, 0 },
{"no-msgs2stderr", 0, POPT_ARG_VAL, &msgs2stderr, 0, 0, 0 },
{"quiet", 'q', POPT_ARG_NONE, 0, 'q', 0, 0 },
{"motd", 0, POPT_ARG_VAL, &output_motd, 1, 0, 0 },
@@ -2187,7 +2187,9 @@ int parse_arguments(int *argc_p, const char ***argv_p)
setvbuf(stdout, (char *)NULL, mode, 0);
}
- if (msgs2stderr) {
+ if (msgs2stderr < 0)
+ msgs2stderr = am_daemon > 0 ? 0 : 2;
+ if (msgs2stderr == 1) {
/* Make stderr line buffered for better sharing of the stream. */
fflush(stderr); /* Just in case... */
setvbuf(stderr, (char *)NULL, _IOLBF, 0);
@@ -2887,6 +2889,11 @@ void server_options(char **args, int *argc_p)
args[ac++] = "--log-format=X";
}
+ if (msgs2stderr == 1)
+ args[ac++] = "--msgs2stderr";
+ else if (msgs2stderr == 0)
+ args[ac++] = "--no-msgs2stderr";
+
if (block_size) {
if (asprintf(&arg, "-B%u", (int)block_size) < 0)
goto oom;