summaryrefslogtreecommitdiffstats
path: root/external/neon/neon_fix_lock_timeout_windows.patch
diff options
context:
space:
mode:
Diffstat (limited to 'external/neon/neon_fix_lock_timeout_windows.patch')
-rw-r--r--external/neon/neon_fix_lock_timeout_windows.patch37
1 files changed, 37 insertions, 0 deletions
diff --git a/external/neon/neon_fix_lock_timeout_windows.patch b/external/neon/neon_fix_lock_timeout_windows.patch
new file mode 100644
index 000000000..72abde762
--- /dev/null
+++ b/external/neon/neon_fix_lock_timeout_windows.patch
@@ -0,0 +1,37 @@
+--- src.origin/ne_locks.c 2007-02-05 11:09:27.000000000 +0100
++++ src/ne_locks.c 2015-11-11 16:12:11.236849082 +0100
+@@ -33,6 +33,10 @@
+ #include <limits.h>
+ #endif
+
++#ifdef HAVE_ERRNO_H
++#include <errno.h>
++#endif
++
+ #include <ctype.h> /* for isdigit() */
+
+ #include "ne_alloc.h"
+@@ -428,9 +432,21 @@
+ if (ne_strcasecmp(timeout, "infinite") == 0) {
+ return NE_TIMEOUT_INFINITE;
+ } else if (strncasecmp(timeout, "Second-", 7) == 0) {
+- long to = strtol(timeout+7, NULL, 10);
+- if (to == LONG_MIN || to == LONG_MAX)
++ // according RFC 4918 the value used for lock timeout is unsigned 32 bit
++ // see: <http://tools.ietf.org/html/rfc4918#section-10.7>
++ // adapt it to the 'long' used internally by neon instead
++ errno = 0;
++ unsigned long to1 = strtoul(timeout+7, NULL, 10);
++ if (to1 == ULONG_MAX && errno == ERANGE)
+ return NE_TIMEOUT_INVALID;
++ NE_DEBUG(NE_DBG_LOCKS, "Parsed lock timeout: %lu\n", to1);
++ long to;
++ // LONG_MAX means around 68 years,
++ // more than enough for practical use
++ if (to1 > LONG_MAX)
++ return LONG_MAX;
++ else
++ to = (long)to1;
+ return to;
+ } else {
+ return NE_TIMEOUT_INVALID;