This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]