This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
sleep (UINT_MAX) broken
- From: Andreas Jaeger <aj at suse dot de>
- To: libc-alpha at sources dot redhat dot com
- Cc: Michael Matz <matz at suse dot de>
- Date: Sat, 28 Jun 2003 16:07:18 +0200
- Subject: sleep (UINT_MAX) broken
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