Skip to content
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

fixes for sysfs devchain logic #3089

Merged
merged 3 commits into from
Jun 18, 2024
Merged

Conversation

t-8ch
Copy link
Member

@t-8ch t-8ch commented Jun 12, 2024

More details in the commit messages.

It does not make sense to leave the sysfs hierarchy during the walk of
the parent directories.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
@t-8ch
Copy link
Member Author

t-8ch commented Jun 12, 2024

I guess it would make sense to have some sort of utility to get a string from a buffer.
ul_buffer_get_string(), or ul_buffer_append_null().

@karelzak
Copy link
Collaborator

I guess it would make sense to have some sort of utility to get a string from a buffer. ul_buffer_get_string(), or ul_buffer_append_null().

If I good remember, it's always zero-terminated in the buffer, but ul_buffer_get_data() does not count the terminator. Anyway, ul_buffer_get_string() sounds good, send patch ;-)

Some users need a zero-byte-terminated string.
As the buffer internally already maintains a zero-termination, add a
helper function that exposes this to users.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
sysfs_blkdev_get_devchain() does not zero-terminate its result, but the
caller expects a C-string.
Use ul_buffer_get_string() which includes a trailing zero-byte.

Now it's also valid for sz and bufsz to be equal.

See util-linux#3088.
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
@t-8ch
Copy link
Member Author

t-8ch commented Jun 13, 2024

send patch ;-)

Done!

@karelzak karelzak merged commit 24e3ede into util-linux:master Jun 18, 2024
33 checks passed
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.

None yet

2 participants