code, file, line);
}
- /* FALLTHROUGH */
-#include "case_N.h"
-
- if (exit_code && exit_code != RERR_RCVR_ERROR
- && exit_code != RERR_STREAMIO && exit_code != RERR_SIGNAL1
- && (protocol_version >= 31 || (!am_sender && !am_generator))) {
- send_msg_int(MSG_ERROR_EXIT, exit_code);
- if (am_server && !am_sender && !am_generator)
- noop_io_until_death();
- }
-
/* FALLTHROUGH */
#include "case_N.h"
code = exit_code = RERR_PARTIAL;
}
- if ((code && code != RERR_RCVR_ERROR)
+ /* If line < 0, this exit is after a MSG_ERROR_EXIT event, so
+ * we don't want to output a duplicate error. */
+ if ((code && line > 0)
|| am_daemon || (logfile_name && (am_server || !INFO_GTE(STATS, 1))))
log_exit(code, file, line);
unmodified_code, file, line, code);
}
+ /* FALLTHROUGH */
+#include "case_N.h"
+
+ if (exit_code && exit_code != RERR_STREAMIO && exit_code != RERR_SIGNAL1
+ && (protocol_version >= 31 || am_server || (!am_sender && !am_generator))) {
+ if (line > 0)
+ send_msg_int(MSG_ERROR_EXIT, exit_code);
+ noop_io_until_death();
+ }
+
/* FALLTHROUGH */
#include "case_N.h"
#define RERR_TIMEOUT 30 /* timeout in data send/receive */
#define RERR_CONTIMEOUT 35 /* timeout waiting for daemon connection */
-#define RERR_RCVR_ERROR 42 /* receiver is exiting with an error */
-
/* Although it doesn't seem to be specified anywhere,
* ssh and the shell seem to return these values:
*
char buf[1024];
kluge_around_eof = 1;
- set_io_timeout(10);
+ set_io_timeout(protocol_version >= 31 ? 10 : 1);
while (1)
read_buf(iobuf.in_fd, buf, sizeof buf);
}
break;
case MSG_ERROR_EXIT:
- if (msg_bytes != 4)
+ if (msg_bytes == 0) {
+ if (!am_sender && !am_generator) {
+ send_msg(MSG_ERROR_EXIT, "", 0, 0);
+ io_flush(FULL_FLUSH);
+ }
+ val = 0;
+ } else if (msg_bytes == 4) {
+ data = perform_io(4, PIO_INPUT_AND_CONSUME);
+ val = IVAL(data, 0);
+ if (protocol_version >= 31) {
+ if (am_generator)
+ send_msg_int(MSG_ERROR_EXIT, val);
+ else
+ send_msg(MSG_ERROR_EXIT, "", 0, 0);
+ }
+ } else
goto invalid_msg;
- data = perform_io(4, PIO_INPUT_AND_CONSUME);
- val = IVAL(data, 0);
- if (am_generator && protocol_version >= 31)
- send_msg_int(MSG_ERROR_EXIT, val);
- if (am_generator)
- val = RERR_RCVR_ERROR; /* avoids duplicate errors */
- exit_cleanup(val);
+ /* Send a negative linenum so that we don't end up
+ * with a duplicate exit message. */
+ _exit_cleanup(val, __FILE__, 0 - __LINE__);
default:
rprintf(FERROR, "unexpected tag %d [%s%s]\n",
tag, who_am_i(), inc_recurse ? "/inc" : "");
{ RERR_DEL_LIMIT , "the --max-delete limit stopped deletions" },
{ RERR_TIMEOUT , "timeout in data send/receive" },
{ RERR_CONTIMEOUT , "timeout waiting for daemon connection" },
- { RERR_RCVR_ERROR , "exiting due to receiver error" },
{ RERR_CMD_FAILED , "remote shell failed" },
{ RERR_CMD_KILLED , "remote shell killed" },
{ RERR_CMD_RUN , "remote command could not be run" },
/* This is used when working on a new protocol version in CVS, and should
* be a new non-zero value for each CVS change that affects the protocol.
* It must ALWAYS be 0 when the protocol goes final (and NEVER before)! */
-#define SUBPROTOCOL_VERSION 11
+#define SUBPROTOCOL_VERSION 12
/* We refuse to interoperate with versions that are not in this range.
* Note that we assume we'll work with later versions: the onus is on