-
Notifications
You must be signed in to change notification settings - Fork 37
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
writer: Fix return value of lcfs_node_unset_xattr #401
writer: Fix return value of lcfs_node_unset_xattr #401
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something went wrong with the commit message formatting...
Since the first creation of this code in 5ac1f5c "lib: Update xattr APIs" this function has always returned an error code - but nothing checked it, so it didn't matter. Now also, currently this function cannot fail but let's give ourselves some flexibility here; perhaps we want to e.g. invoke `realloc` and in that case we'd need to handle OOM. I just noticed this while working on commit 02077e8 to reject empty xattr names. Change this to return success, and also check its return value in the set path. Signed-off-by: Colin Walters <walters@verbum.org>
Came up in chat, the semantics defined today is last-one-wins. Let's test that. Signed-off-by: Colin Walters <walters@verbum.org>
586776f
to
306f24d
Compare
I also added a test case for the multiple xattr path. |
Can you be more specific? |
Same as we talked about today. It's wrapped at 50. Not important :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
else | ||
node->xattr_size = 0; // If last xattr, remove the overhead too | ||
assert(node->xattr_size >= 0); | ||
if (index < 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This way around reads a lot nicer now. Thanks for the change.
Since the first creation of this code in
5ac1f5c "lib: Update xattr APIs" this function
has always returned an error code - but nothing
checked it, so it didn't matter.
Now also, currently this function cannot fail
but let's give ourselves some flexibility here;
perhaps we want to e.g. invoke
realloc
and in that case we'd need to handle OOM.
I just noticed this while working on commit
02077e8
to reject empty xattr names.
Change this to return success, and also check its
return value in the set path.