lib/xnanosleep.c currently assumes nanosleep works with any value that
can be fit into the struct timespec. For gnu+linux on a 
platform with 64 bit longs, this isn't true (it currently doesn't even
return and error but just silently integer-overflows, but I've
submitted a patch to make it error).

I haven't checked how other operating systems handle this (do any
others even have 64 bit time_t's?), but the follow patch stops it from
failing silently on linux, and if and when my patch is accepted, it
stops it from erroring.

If there are other operating systems the coreutils run on that handle
64 bit time_t's properly this should be "#ifdef linux"-ed, but I'll
leave that to someone who knows more about the build system.

--- coreutils/lib/xnanosleep.c.old      2006-08-27 10:49:11.000000000 +0200
+++ coreutils/lib/xnanosleep.c  2006-08-27 11:40:25.000000000 +0200
@@ -34,9 +34,10 @@
 
 #include "intprops.h"
 #include "timespec.h"
+#include "minmax.h"
 
 #ifndef TIME_T_MAX
-# define TIME_T_MAX TYPE_MAXIMUM (time_t)
+# define TIME_T_MAX MIN(TYPE_MAXIMUM (time_t), (~(1<<31)))
 #endif
 
 /* Sleep until the time (call it WAKE_UP_TIME) specified as

-- 
Frank v Waveren                                  Key fingerprint: BDD7 D61E
[EMAIL PROTECTED]                                              5D39 CF05 4BFC 
F57A
Public key: hkp://wwwkeys.pgp.net/468D62C8              FA00 7D51 468D 62C8

Attachment: signature.asc
Description: Digital signature

_______________________________________________
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils

Reply via email to