Skip to content

Commit

Permalink
Document address length calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomasdezeeuw committed Jun 9, 2024
1 parent 2c66ff6 commit d992f78
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/sys/unix/uds/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ fn unix_addr(address: &SocketAddr) -> (libc::sockaddr_un, libc::socklen_t) {
};

let mut addrlen = path_offset(&sockaddr) + addr.len();
// +1 for null byte at the end of the path, not needed for abstract
// namespaces (which start with a null byte).
match addr.first() {
Some(&0) | None => {}
Some(_) => addrlen += 1,
Expand Down

0 comments on commit d992f78

Please sign in to comment.