From 553f286a8f17e84b6957101ab37b7d817a6a2929 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 27 Jan 2021 16:39:24 +0100 Subject: [PATCH] tool_writeout: make %{errormsg} blank for no errors Closes #6539 --- src/tool_writeout.c | 7 ++++--- tests/data/test1029 | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/tool_writeout.c b/src/tool_writeout.c index 9ce0a997e5..c548bd8f2d 100644 --- a/src/tool_writeout.c +++ b/src/tool_writeout.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2020, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2021, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -137,8 +137,9 @@ void ourWriteOut(CURL *curl, struct per_transfer *per, const char *writeinfo, fprintf(stream, "%d", (int)result); break; case VAR_ERRORMSG: - fputs(per->errorbuffer[0] ? per->errorbuffer : - curl_easy_strerror(result), stream); + if(result) + fputs(per->errorbuffer[0] ? per->errorbuffer : + curl_easy_strerror(result), stream); break; case VAR_INPUT_URL: if(per->this_url) diff --git a/tests/data/test1029 b/tests/data/test1029 index 36797e3347..b1f5982e48 100644 --- a/tests/data/test1029 +++ b/tests/data/test1029 @@ -50,7 +50,7 @@ Content-Length: 62 Connection: close This server reply is for testing a simple Location: following -http://%HOSTIP:%HTTPPORT/we/want/our/data/10290002.txt?coolsite=yes http://%HOSTIP:%HTTPPORT/we/want/our/1029 0 No error +http://%HOSTIP:%HTTPPORT/we/want/our/data/10290002.txt?coolsite=yes http://%HOSTIP:%HTTPPORT/we/want/our/1029 0 -- 2.47.3