Skip to content

libcomposefs: do not override errno#307

Merged
cgwalters merged 1 commit intocomposefs:mainfrom
giuseppe:not-override-errno
Jul 30, 2024
Merged

libcomposefs: do not override errno#307
cgwalters merged 1 commit intocomposefs:mainfrom
giuseppe:not-override-errno

Conversation

@giuseppe
Copy link
Copy Markdown
Collaborator

do not override the errno reported by the write_cb as we might lose useful errors like ENOSPC.

do not override the errno reported by the write_cb as we might lose
useful errors like ENOSPC.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

if (ctx->write_cb) {
while (data_len > 0) {
errno = EIO;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I guess we need to do this because we can't rely on callers setting errno...and indeed in our own code which uses fwrite, it doesn't?

So...okay, is there really no way to get the actual error out of ferror?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I guess fwrite is...somewhat expected conventionally to set errno, but it's not standardized?

@cgwalters cgwalters merged commit 3a87868 into composefs:main Jul 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants