Skip to content

No failure when the header file can't be written #13836

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
bofh69 opened this issue May 31, 2024 · 3 comments
Closed

No failure when the header file can't be written #13836

bofh69 opened this issue May 31, 2024 · 3 comments
Labels
cmdline tool not-a-curl-bug This is not a bug in curl

Comments

@bofh69
Copy link

bofh69 commented May 31, 2024

I did this

curl -D /dev/full https://github.com/ > /dev/null
and got 0 as exit code.

I expected the following

I expected to get an exit code 23 from curl when the headers couldn't be written because of ENOSPC.

curl/libcurl version

curl 7.81.0, curl from master (acb9eff).

operating system

Linux LUM-PF3VPCE9 6.5.0-28-generic #29~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Apr 4 14:39:20 UTC 2 x86_64 x86_64 x86_64 GNU/Linux

@bagder
Copy link
Member

bagder commented Jun 1, 2024

It does not return an error because fwrite() returns success every time:

size_t rc = fwrite(ptr, size, nmemb, heads->stream);

@bagder bagder added the not-a-curl-bug This is not a bug in curl label Jun 1, 2024
@bofh69
Copy link
Author

bofh69 commented Jun 2, 2024

@bagder that is an allowed way for fwrite to work. If buffering is in use (and large enough), the write to the buffer works fine and it returns the right amount of data written to the buffer.

One has to check the return value of fflush or fclose to see that everything was written.

@bagder
Copy link
Member

bagder commented Jun 2, 2024

ah, of course!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cmdline tool not-a-curl-bug This is not a bug in curl
Development

Successfully merging a pull request may close this issue.

2 participants