$NetBSD: patch-ad,v 1.1 2008/02/27 23:50:29 apb Exp $ --- src/common.c.orig 2008-01-08 18:57:30.000000000 +0200 +++ src/common.c @@ -606,3 +606,22 @@ 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); +}