summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnders Björklund <anders@itension.se>2015-04-12 10:12:56 +0200
committerAnders Björklund <anders@itension.se>2015-08-25 20:22:43 +0200
commit4738c7a6e889bb62238f8ab4b5fbea087e9b0ece (patch)
tree24d793913080984b91a039740e4d530f039812cc
parent267fe5be154ca375ac574875894b476b60f19af0 (diff)
downloaddistcc-git-4738c7a6e889bb62238f8ab4b5fbea087e9b0ece.tar.gz
Avoid protocol derailment for errors
Sometimes on a busy server, you will get errors reading stdout/stderr. If we send out DOTO 0 without SERR/SOUT, we get a protocol derailment. It is better to avoid sending DOTO 0 in those cases, so that we get a better error report on the client and avoid a "scary" warning message.
-rw-r--r--src/serve.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/serve.c b/src/serve.c
index 5eb940c..f99904a 100644
--- a/src/serve.c
+++ b/src/serve.c
@@ -689,13 +689,16 @@ static int dcc_run_job(int in_fd,
if ((ret = dcc_x_result_header(out_fd, protover))
|| (ret = dcc_x_cc_status(out_fd, status))
|| (ret = dcc_x_file(out_fd, err_fname, "SERR", compr, NULL))
- || (ret = dcc_x_file(out_fd, out_fname, "SOUT", compr, NULL))
- || WIFSIGNALED(status)
- || WEXITSTATUS(status)) {
+ || (ret = dcc_x_file(out_fd, out_fname, "SOUT", compr, NULL))) {
+ /* We get a protocol derailment if we send DOTO 0 here */
+
+ if (job_result == -1)
+ job_result = STATS_COMPILE_ERROR;
+ } else if (WIFSIGNALED(status) || WEXITSTATUS(status)) {
/* Something went wrong, so send DOTO 0 */
dcc_x_token_int(out_fd, "DOTO", 0);
- if (job_result == -1)
+ if (job_result == -1)
job_result = STATS_COMPILE_ERROR;
} else {
if (cpp_where == DCC_CPP_ON_SERVER) {