Merge pull request #8977 from LemonBoy/fix-unix-sockets

Fix connectUnix/bindUnix with abstract socket paths
This commit is contained in:
Andreas Rumpf 2018-09-16 11:34:11 +02:00 • committed by GitHub
commit 566edd54b6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View file

@ -964,7 +964,7 @@ when defined(posix) or defined(nimdoc):
when not defined(nimdoc):
var socketAddr = makeUnixAddr(path)
if socket.fd.connect(cast[ptr SockAddr](addr socketAddr),
sizeof(socketAddr).Socklen) != 0'i32:
(sizeof(socketAddr.sun_family) + path.len).Socklen) != 0'i32:
raiseOSError(osLastError())
proc bindUnix*(socket: Socket, path: string) =
@ -973,7 +973,7 @@ when defined(posix) or defined(nimdoc):
when not defined(nimdoc):
var socketAddr = makeUnixAddr(path)
if socket.fd.bindAddr(cast[ptr SockAddr](addr socketAddr),
sizeof(socketAddr).Socklen) != 0'i32:
(sizeof(socketAddr.sun_family) + path.len).Socklen) != 0'i32:
raiseOSError(osLastError())
when defined(ssl):