diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2017-07-30 14:05:39 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2017-07-30 14:05:39 +0000 |
commit | 3c5f5aea891c85dbdfc4d287d7ebf2bb813d6405 (patch) | |
tree | b027104ec049bf42447fc4ca41173f333b1d528a /src | |
parent | 2858f5c4b1fe40d0970b18e8d155acf3d900ab6e (diff) | |
download | skalibs-3c5f5aea891c85dbdfc4d287d7ebf2bb813d6405.tar.xz |
Fix a case where socket_deadlineconnstamp* could modify errno on success (thanks jlyo)
Diffstat (limited to 'src')
-rw-r--r-- | src/libstddjb/socket_deadlineconnstamp4.c | 2 | ||||
-rw-r--r-- | src/libstddjb/socket_deadlineconnstamp46.c | 2 | ||||
-rw-r--r-- | src/libstddjb/socket_deadlineconnstamp6.c | 2 |
3 files changed, 6 insertions, 0 deletions
diff --git a/src/libstddjb/socket_deadlineconnstamp4.c b/src/libstddjb/socket_deadlineconnstamp4.c index 1bb4e34..5691932 100644 --- a/src/libstddjb/socket_deadlineconnstamp4.c +++ b/src/libstddjb/socket_deadlineconnstamp4.c @@ -6,7 +6,9 @@ int socket_deadlineconnstamp (int s, char const *ip, uint16_t port, tain_t const *deadline, tain_t *stamp) { + int e = errno ; if (socket_connect4(s, ip, port) >= 0) return 1 ; if (!error_isagain(errno) && !error_isalready(errno)) return 0 ; + errno = e ; return socket_waitconn(s, deadline, stamp) ; } diff --git a/src/libstddjb/socket_deadlineconnstamp46.c b/src/libstddjb/socket_deadlineconnstamp46.c index 437cdb9..ac1160c 100644 --- a/src/libstddjb/socket_deadlineconnstamp46.c +++ b/src/libstddjb/socket_deadlineconnstamp46.c @@ -7,7 +7,9 @@ int socket_deadlineconnstamp46 (int s, ip46_t const *i, uint16_t port, tain_t const *deadline, tain_t *stamp) { + int e = errno ; if (socket_connect46(s, i, port) >= 0) return 1 ; if (!error_isagain(errno) && !error_isalready(errno)) return 0 ; + errno = e ; return socket_waitconn(s, deadline, stamp) ; } diff --git a/src/libstddjb/socket_deadlineconnstamp6.c b/src/libstddjb/socket_deadlineconnstamp6.c index 656a2d1..d03fabe 100644 --- a/src/libstddjb/socket_deadlineconnstamp6.c +++ b/src/libstddjb/socket_deadlineconnstamp6.c @@ -6,7 +6,9 @@ int socket_deadlineconnstamp6 (int s, char const *ip, uint16_t port, tain_t const *deadline, tain_t *stamp) { + int e = errno ; if (socket_connect6(s, ip, port) >= 0) return 1 ; if (!error_isagain(errno) && !error_isalready(errno)) return 0 ; + errno = e ; return socket_waitconn(s, deadline, stamp) ; } |