diff options
author | Nick Mathewson <nickm@torproject.org> | 2005-07-13 15:24:33 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2005-07-13 15:24:33 +0000 |
commit | 278bac421f37ffb4f69b25e3132051e3f1028680 (patch) | |
tree | 905cc032e811718a63616f18e7348b2e2f39382b /src/common/compat.c | |
parent | 70002930b9e9e3256bee83e26af7eb0014b17427 (diff) | |
download | tor-278bac421f37ffb4f69b25e3132051e3f1028680.tar.gz tor-278bac421f37ffb4f69b25e3132051e3f1028680.zip |
Fix windows compilation
svn:r4543
Diffstat (limited to 'src/common/compat.c')
-rw-r--r-- | src/common/compat.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/common/compat.c b/src/common/compat.c index 9385280336..b1ec7ef640 100644 --- a/src/common/compat.c +++ b/src/common/compat.c @@ -160,7 +160,7 @@ tor_memmem(const void *_haystack, size_t hlen, const void *_needle, size_t nlen) end = haystack + hlen; first = *(const char*)needle; while ((p = memchr(p, first, end-p))) { - if (end-p >= nlen) + if (p+nlen >= end) return NULL; if (!memcmp(p, needle, nlen)) return p; @@ -340,7 +340,11 @@ tor_socketpair(int family, int type, int protocol, int fd[2]) if (!SOCKET_IS_POLLABLE(listener)) { log_fn(LOG_WARN, "Too many connections; can't open socketpair"); tor_close_socket(listener); +#ifdef MS_WINDOWS + return -ENFILE; +#else return -ENCONN; +#endif } memset(&listen_addr, 0, sizeof(listen_addr)); listen_addr.sin_family = AF_INET; |