diff options
author | Andreas Schneider <asn@cryptomilk.org> | 2015-04-10 10:40:48 +0200 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2015-04-10 13:32:09 +0200 |
commit | 3f04367fb8fbcf18e46cb09a766b18f36ffd9602 (patch) | |
tree | a885fcb931f0202f304c8ee62cb75575a6a239b6 /include | |
parent | 6c7e55250927859ad2b7fee06e710402ff564f4c (diff) | |
download | libssh-3f04367fb8fbcf18e46cb09a766b18f36ffd9602.tar.gz libssh-3f04367fb8fbcf18e46cb09a766b18f36ffd9602.tar.xz libssh-3f04367fb8fbcf18e46cb09a766b18f36ffd9602.zip |
bind: Correctly close sockets and invalidate them.
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/libssh/priv.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/include/libssh/priv.h b/include/libssh/priv.h index e8b50ba0..0c5129c5 100644 --- a/include/libssh/priv.h +++ b/include/libssh/priv.h @@ -109,11 +109,15 @@ struct timeval; int gettimeofday(struct timeval *__p, void *__t); +#define _XCLOSESOCKET closesocket + #else /* _WIN32 */ #include <unistd.h> #define PRIdS "zd" +#define _XCLOSESOCKET close + #endif /* _WIN32 */ #include "libssh/libssh.h" @@ -332,5 +336,7 @@ int match_hostname(const char *host, const char *pattern, unsigned int len); #define __VA_NARG__(...) (-1) #endif +#define CLOSE_SOCKET(s) do { if ((s) != SSH_INVALID_SOCKET) { _XCLOSESOCKET(s); (s) = SSH_INVALID_SOCKET;} } while(0) + #endif /* _LIBSSH_PRIV_H */ /* vim: set ts=4 sw=4 et cindent: */ |