On Mon, Jan 07, 2019 at 06:47:37PM -0800, Masaya Suzuki wrote: > HTTP_KEEP_ERROR makes it easy to debug HTTP transport errors. In order > to make HTTP_KEEP_ERROR enabled for all requests, file handles need to > be supported. > > Signed-off-by: Masaya Suzuki <masayasuzuki@xxxxxxxxxx> > --- > http.c | 9 ++++++--- > 1 file changed, 6 insertions(+), 3 deletions(-) > > diff --git a/http.c b/http.c > index 0b6807cef9..06450da96e 100644 > --- a/http.c > +++ b/http.c > @@ -1991,16 +1991,19 @@ static int http_request_reauth(const char *url, > /* > * If we are using KEEP_ERROR, the previous request may have > * put cruft into our output stream; we should clear it out before > - * making our next request. We only know how to do this for > - * the strbuf case, but that is enough to satisfy current callers. > + * making our next request. > */ > if (options && options->keep_error) { > switch (target) { > case HTTP_REQUEST_STRBUF: > strbuf_reset(result); > break; > + case HTTP_REQUEST_FILE: > + fflush(result); > + ftruncate(fileno(result), 0); Some GCC versions complain about the above line: http.c: In function ‘http_request_reauth’: http.c:1961:3: error: ignoring return value of ‘ftruncate’, declared with attribute warn_unused_result [-Werror=unused-result] ftruncate(fileno(result), 0); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ CC shell.o CC remote-testsvn.o CC vcs-svn/line_buffer.o cc1: all warnings being treated as errors make: *** [http.o] Error 1 make: *** Waiting for unfinished jobs.... > + break; > default: > - BUG("HTTP_KEEP_ERROR is only supported with strbufs"); > + BUG("Unknown http_request target"); > } > } > > -- > 2.20.1.97.g81188d93c3-goog >