Skip to content

Commit

Permalink
fix according to nh2's comment
Browse files Browse the repository at this point in the history
  • Loading branch information
kazu-yamamoto committed Jul 17, 2024
1 parent 412dd0d commit 33b45f8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Network/Socket/Types.hsc
Original file line number Diff line number Diff line change
Expand Up @@ -1157,9 +1157,10 @@ unixPathMax = #const sizeof(((struct sockaddr_un *)NULL)->sun_path)
pokeSockAddr :: Ptr a -> SockAddr -> IO ()
pokeSockAddr p sa@(SockAddrUnix path) = do
let pathC = map castCharToCChar path
when (length pathC >= unixPathMax) $ error
len = length pathC
when (len >= unixPathMax) $ error
$ "pokeSockAddr: path is too long in SockAddrUnix " <> show path
<> ", length " <> show (length path) <> ", unixPathMax " <> show unixPathMax
<> ", length " <> show len <> ", unixPathMax " <> show unixPathMax
zeroMemory p $ fromIntegral $ sizeOfSockAddr sa
# if defined(HAVE_STRUCT_SOCKADDR_SA_LEN)
(#poke struct sockaddr_un, sun_len) p ((#const sizeof(struct sockaddr_un)) :: Word8)
Expand Down

0 comments on commit 33b45f8

Please sign in to comment.