Skip to content

net: UnixListener.AcceptUnix returns a UnixConn with incorrect network type string #7183

Closed
@jgennis

Description

@jgennis
What steps will reproduce the problem?

Run the code at http://play.golang.org/p/FJBS8MOF72 on a system supporting the
"unixpacket" network type (not play.golang.org).

What is the expected output?

unixpacket
unixpacket
unixpacket

What do you see instead?

unixpacket
unix
unix

Which compiler are you using (5g, 6g, 8g, gccgo)?

6g

Which operating system are you using?

Linux

Which version are you using?  (run 'go version')

go version go1.2 linux/amd64

Please provide any additional information below.

It looks like the problem is that UnixListener.AcceptUnix unconditionally passes
sockaddrToUnix to the fd.accept() call that it makes.  I'm guessing that it should
instead pass either sockaddrToUnix or sockaddrToUnixpacket based on the network type of
the listener.

Note that the underlying socket appears to be the correct type.  It's just the reported
*Addr().Network() strings that are wrong.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions