Patch by Vasilis Kaoutsis: Return error code via errno.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22484 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2007-10-08 15:32:02 +00:00
parent 899d854005
commit a16571b404

View File

@ -15,12 +15,17 @@ uint
alarm(unsigned int sec)
{
struct itimerval value, oldValue;
int result;
value.it_interval.tv_sec = value.it_interval.tv_usec = 0;
value.it_value.tv_sec = sec;
value.it_value.tv_usec = 0;
if (setitimer(ITIMER_REAL, &value, &oldValue) < 0)
result = setitimer(ITIMER_REAL, &value, &oldValue);
if (result < 0) {
errno = result;
return -1;
}
if (oldValue.it_value.tv_usec)
oldValue.it_value.tv_sec++;