diff options
author | Grisha Levit <grishalevit@gmail.com> | 2023-03-04 16:32:56 -0500 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2023-03-06 11:14:37 +0100 |
commit | 1dd929674e09093ca6abb069cd84d6b99d350656 (patch) | |
tree | 97247d7a981dd548e890bc5faa80b517480c6e05 /src | |
parent | c12e8bfa894c32d6a82cf662859cd0015db1ae18 (diff) | |
download | curl-1dd929674e09093ca6abb069cd84d6b99d350656.tar.gz |
tool: dump headers even if file is write-only
The fixes in #10079 brought a (seemingly unrelated) change of open mode
from `wb`/`ab` to `wb+`/`ab+` for the headerfile. This makes it no
longer possible to write the header file to e.g. a pipe, like:
curl -D >(grep ...) file:///dev/null
Which presently results in `Warning: Failed to open /dev/fd/63`
See #10079
Closes #10675
Diffstat (limited to 'src')
-rw-r--r-- | src/tool_operate.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/tool_operate.c b/src/tool_operate.c index 804d981d9..f694f088d 100644 --- a/src/tool_operate.c +++ b/src/tool_operate.c @@ -983,11 +983,11 @@ static CURLcode single_transfer(struct GlobalConfig *global, * for every transfer. */ if(!per->prev || per->prev->config != config) { - newfile = fopen(config->headerfile, "wb+"); + newfile = fopen(config->headerfile, "wb"); if(newfile) fclose(newfile); } - newfile = fopen(config->headerfile, "ab+"); + newfile = fopen(config->headerfile, "ab"); if(!newfile) { errorf(global, "Failed to open %s\n", config->headerfile); |