Skip to content

Commit f9d7dce

Browse files
eyeinskykazu-yamamoto
authored andcommitted
Print socket path, its length and unixPathMax on error
1 parent 09f30fa commit f9d7dce

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Network/Socket/Types.hsc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1151,7 +1151,9 @@ unixPathMax = #const sizeof(((struct sockaddr_un *)NULL)->sun_path)
11511151
pokeSockAddr :: Ptr a -> SockAddr -> IO ()
11521152
#if defined(DOMAIN_SOCKET_SUPPORT)
11531153
pokeSockAddr p sa@(SockAddrUnix path) = do
1154-
when (length path > unixPathMax) $ error "pokeSockAddr: path is too long"
1154+
when (length path > unixPathMax) $ error
1155+
$ "pokeSockAddr: path is too long in SockAddrUnix " <> show path
1156+
<> ", length " <> show (length path) <> ", unixPathMax " <> show unixPathMax
11551157
zeroMemory p $ fromIntegral $ sizeOfSockAddr sa
11561158
# if defined(HAVE_STRUCT_SOCKADDR_SA_LEN)
11571159
(#poke struct sockaddr_un, sun_len) p ((#const sizeof(struct sockaddr_un)) :: Word8)

0 commit comments

Comments
 (0)