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

Remove last null from UDS address #1817

Merged
merged 1 commit into from
Jul 23, 2024
Merged

Conversation

Thomasdezeeuw
Copy link
Collaborator

Before passing it to SocketAddr::from_pathname.

This was a problem for Tokio's test suite where
uds_socket::listen_and_stream failed. We can't reproduce the problem with just Mio's type as Mio doesn't allow a UnixStream to bound to a local path before connecting it.

Before passing it to SocketAddr::from_pathname.

This was a problem for Tokio's test suite where
uds_socket::listen_and_stream failed. We can't reproduce the problem
with just Mio's type as Mio doesn't allow a UnixStream to bound to a
local path before connecting it.
Comment on lines +116 to +118
if let Some(0) = path.last() {
path = &path[..path.len() - 1];
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Not a while loop?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It should only be a single null to create a C "string". The OS returns a null terminated string (though not always, I think around the max size it's not null terminated).

@Thomasdezeeuw Thomasdezeeuw merged commit 5306ad3 into master Jul 23, 2024
60 checks passed
@Thomasdezeeuw Thomasdezeeuw deleted the last-null-in-accept branch July 23, 2024 10:58
This pull request was closed.
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