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
Fix 14611 - socket.localAddress fails on Unix sockets with longer path (> 13 characters) #3300
Conversation
On reviewing the documentation, it looks like this change is correct. |
Don't forget to add the test case from the bug report as a new unit test. |
assert(listener.localAddress.toString == name); ... in the existing unittest will trigger the bug, thus no additional test case. |
OK, thanks. LGTM. |
|
||
this() pure nothrow @nogc | ||
{ | ||
sun.sun_family = AF_UNIX; | ||
sun.sun_path[].uninitializedFill('?'); |
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 doesn't make sense. sun_path
is a byte[]
, uninitializedFill
is only needed for structs with copy ctors, and for cases where the data is uninitialized (in this case, it will be initialized).
I don't think we need a specialized function here, just:
sun.sun_path[] = '?';
And remove the import for uninitializedFill
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.
You are right! I didn't know that you can fill an array like this.
I updated the title. Please in the future include the bug title in the PR title so it's easy to know what the PR is about. Thanks. LGTM except for the uninitializedFill thing |
Auto-merge toggled on |
Fix 14611 - socket.localAddress fails on Unix sockets with longer path (> 13 characters)
See https://issues.dlang.org/show_bug.cgi?id=14611