Skip to content

Commit

Permalink
Merge pull request #220 from mitchellwrosen/master
Browse files Browse the repository at this point in the history
Zero memory of sockaddr_un if abstract socket
  • Loading branch information
kazu-yamamoto authored Aug 15, 2016
2 parents 1caf74b + f06b31d commit 79e7fac
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Network/Socket/Types.hsc
Original file line number Diff line number Diff line change
Expand Up @@ -922,6 +922,10 @@ pokeSockAddr :: Ptr a -> SockAddr -> IO ()
pokeSockAddr p (SockAddrUnix path) = do
#if defined(darwin_HOST_OS)
zeroMemory p (#const sizeof(struct sockaddr_un))
#else
case path of
('\0':_) -> zeroMemory p (#const sizeof(struct sockaddr_un))
_ -> return ()
#endif
#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 79e7fac

Please sign in to comment.