Fix cases of overwriting errno
authorSubodh Iyengar <subodh@fb.com>
Mon, 28 Mar 2016 23:48:51 +0000 (16:48 -0700)
committerFacebook Github Bot 0 <facebook-github-bot-0-bot@fb.com>
Mon, 28 Mar 2016 23:50:33 +0000 (16:50 -0700)
commit6f06849839fede8c10ebce6feb2a10e082ea5750
tree17492eb97b158fe420a3fc151de780f560ca0c25
parent03343ccb443b2ca14b2c1d4ebc99e2ede30aee74
Fix cases of overwriting errno

Summary:AsyncSocket has a few cases where
we might overwrite errno, with another function
call that is done during use.

For example withAddr could cause an EBADF if the fd
was bad.

This fixes these cases by copying errno, before doing
anything else

Reviewed By: afrind

Differential Revision: D3101932

fb-gh-sync-id: 73d4810314c90cb987936a0a3a9dc977af07243a
fbshipit-source-id: 73d4810314c90cb987936a0a3a9dc977af07243a
folly/io/async/AsyncSocket.cpp