Files
pkgsrc-ng/net/3proxy/patches/patch-ad
2016-01-21 23:41:46 +01:00

27 lines
839 B
Plaintext

$NetBSD: patch-ad,v 1.2 2015/04/06 02:26:53 rodent Exp $
--- src/common.c.orig 2015-02-17 13:07:20.000000000 +0000
+++ src/common.c
@@ -719,3 +719,21 @@ unsigned long getip(unsigned char *name)
#endif
return retval;
}
+
+/*
+ * POSIX says:
+ * The usleep() function may fail if:
+ * [EINVAL] The time interval specified one million or more microseconds.
+ *
+ * Other code in 3proxy calls usleep with much larger arguments, but
+ * that gets redirected here via "#define usleep(usecs) myusleep(usecs)"
+ * in proxy.h. We call sleep() for any whole number of seconds, and
+ * the real usleep() for any left over microseconds.
+ */
+int myusleep(useconds_t useconds)
+{
+ unsigned int secs = useconds / 1000000;
+ useconds = useconds % 1000000;
+ if (secs > 0) sleep(secs);
+ return (usleep)(useconds);
+}