Skip to content

Commit

Permalink
tool_writeout: make %{errormsg} blank for no errors
Browse files Browse the repository at this point in the history
Closes curl#6539
  • Loading branch information
bagder committed Jan 28, 2021
1 parent 3611f6a commit 553f286
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions src/tool_writeout.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2021, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion tests/data/test1029
Original file line number Diff line number Diff line change
Expand Up @@ -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
</stdout>
</verify>
</testcase>

0 comments on commit 553f286

Please sign in to comment.