libc: update alarm() implementation to return 0 on error.
This matches the GLibc behaviour, and allows alarm(0xFFFFFFFF) to return 0. Change-Id: I419aa71b27d6bb2015d15ba6b6112bf62eadcbb8
This commit is contained in:
@@ -51,7 +51,11 @@ alarm(secs)
|
||||
itp->it_value.tv_sec = secs;
|
||||
itp->it_value.tv_usec = 0;
|
||||
if (setitimer(ITIMER_REAL, itp, &oitv) < 0)
|
||||
#if 1 /* BIONIC: Same behaviour than GLibc for errors */
|
||||
return 0;
|
||||
#else
|
||||
return (-1);
|
||||
#endif
|
||||
if (oitv.it_value.tv_usec)
|
||||
oitv.it_value.tv_sec++;
|
||||
return (oitv.it_value.tv_sec);
|
||||
|
||||
Reference in New Issue
Block a user