From: Stephan Bosch Date: Mon, 20 Apr 2020 22:16:05 +0000 (+0200) Subject: lib-http: test-http-payload - Fix dead assignments. X-Git-Tag: 2.3.11.2~167 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=75392fb34e93999ac94e0034e71eca71eb189bde;p=thirdparty%2Fdovecot%2Fcore.git lib-http: test-http-payload - Fix dead assignments. Found by Clang scan-build. --- diff --git a/src/lib-http/test-http-payload.c b/src/lib-http/test-http-payload.c index 12825eeb75..811ba1c1c5 100644 --- a/src/lib-http/test-http-payload.c +++ b/src/lib-http/test-http-payload.c @@ -292,7 +292,6 @@ client_handle_download_request(struct client_request *creq, output = http_server_response_get_payload_output( resp, IO_BLOCK_SIZE, TRUE); - ret = 0; switch (o_stream_send_istream(output, fstream)) { case OSTREAM_SEND_ISTREAM_RESULT_WAIT_INPUT: case OSTREAM_SEND_ISTREAM_RESULT_WAIT_OUTPUT: @@ -300,7 +299,8 @@ client_handle_download_request(struct client_request *creq, case OSTREAM_SEND_ISTREAM_RESULT_FINISHED: /* finish it */ ret = o_stream_finish(output); - if (ret >= 0) + i_assert(ret != 0); + if (ret > 0) break; /* fall through */ case OSTREAM_SEND_ISTREAM_RESULT_ERROR_OUTPUT: @@ -316,7 +316,6 @@ client_handle_download_request(struct client_request *creq, i_stream_get_name(fstream), i_stream_get_error(fstream)); } - i_assert(ret != 0); if (debug) { i_debug("test server: download: " @@ -495,7 +494,6 @@ client_request_echo_ostream_blocking(struct client_request *creq, if (tset.server_cork) o_stream_cork(payload_output); - ret = 0; switch (o_stream_send_istream(payload_output, input)) { case OSTREAM_SEND_ISTREAM_RESULT_WAIT_INPUT: case OSTREAM_SEND_ISTREAM_RESULT_WAIT_OUTPUT: @@ -503,7 +501,8 @@ client_request_echo_ostream_blocking(struct client_request *creq, case OSTREAM_SEND_ISTREAM_RESULT_FINISHED: /* finish it */ ret = o_stream_finish(payload_output); - if (ret >= 0) + i_assert(ret != 0); + if (ret > 0) break; /* fall through */ case OSTREAM_SEND_ISTREAM_RESULT_ERROR_OUTPUT: @@ -519,7 +518,7 @@ client_request_echo_ostream_blocking(struct client_request *creq, i_stream_get_name(input), creq->path, i_stream_get_error(input)); } - i_assert(ret != 0); + if (debug) { i_debug("test server: echo: " "sent all payload for %s", creq->path);