Subject: net/echoping patch
To: None <>
From: Jeff Rizzo <>
List: tech-pkg
Date: 04/20/2006 15:41:01
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Since net/echoping has '' as a maintainer, and I don't
have time right now to make sure this patch doesn't break anything for
others, I submit for Someone Else to commit this if it seems appropriate.
(I've already submitted it as a bug to the echoping sourceforge site;
hopefully it will get picked up in the next version)

The problem:  if an OS has usleep() (like NetBSD does), the inter-packet
gap is always timed with usleep(wait * 1000000), where wait is
a (double) number of seconds.  However, SUSv3 states that the argument
to usleep() should be less than 1000000, and indeed, on NetBSD the
usleep() fails when wait is >=3D 1.0.   So, I cooked up the following
patch, which makes it behave in a fashion more consistent with the

--- echoping.c.orig	2006-04-20 15:09:49.000000000 -0700
+++ echoping.c	2006-04-20 15:20:24.000000000 -0700
@@ -655,7 +655,13 @@
       if (i > 1)
-	  usleep (wait * 1000000);
+	  /*
+	   * SUSv3 states that the argument to usleep() shall be less
+	   * than 1000000, so split into two calls if necessary.
+	   */=20
+	  if (wait >=3D 1)
+	  	sleep (wait);
+	  usleep ((wait - (unsigned int)wait) * 1000000);
 	  sleep (wait);

As I said, if someone could double-check me and commit this to pkgsrc,
I'd be grateful...


Content-Type: application/pgp-signature
Content-Disposition: inline

Version: GnuPG v1.4.1 (NetBSD)