Skip to content

OpenBSD socket address is padded with zeroes #116523

Closed
@notgull

Description

@notgull

I tried this code on my Linux machine:

use std::os::unix::net::UnixListener;

fn main() {
    let listener = UnixListener::bind("/tmp/rust-uds.sock").unwrap();
    println!("{:?}", listener.local_addr().unwrap());
}

I got this output:

"/tmp/rust-uds.sock" (pathname)

However, on OpenBSD 7, I got this output:

"/tmp/rust-uds.sock\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" (pathname)

I expected the output to be the same as Linux: not padded with zeroes like this.

Meta

rustc --version --verbose:

$ rustc --version --verbose
rustc 1.63.0
binary: rustc
commit-hash: unknown
commit-date: unknown
host: x86_64-unknown-openbsd
release: 1.63.0
LLVM version: 13.0.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ioArea: `std::io`, `std::fs`, `std::net` and `std::path`C-bugCategory: This is a bug.O-openbsdOperating system: OpenBSDT-libsRelevant to the library team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions