sleep (UINT_MAX) broken
Andreas Jaeger
aj@suse.de
Sat Jun 28 14:07:00 GMT 2003
This small program returns directly with:
gromit:~/tmp:[0]$ ./a.out
Ret is :4294967295
#include <unistd.h>
#include <stdio.h>
#include <limits.h>
int
main (void)
{
unsigned int ret;
ret = sleep (UINT_MAX);
printf ("Ret is :%u\n", ret);
return 0;
}
The problem is that we convert the unsigned argument to sleep into a
signed value (-1) and then pass that to nanosleep.
This worked with older versions of Glibc AFAIK.
What can we do here? I don't understand what Posix requires from us
here:-(
Andreas
--
Andreas Jaeger, aj@suse.de, http://www.suse.de/~aj
SuSE Linux AG, Deutschherrnstr. 15-19, 90429 Nürnberg, Germany
GPG fingerprint = 93A3 365E CE47 B889 DF7F FED1 389A 563C C272 A126
More information about the Libc-alpha
mailing list