Patch by Vasilis Kaoutsis: Correctly set errno on error.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22519 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2007-10-12 16:49:56 +00:00
parent 36b89f8f12
commit e8cae7424e
1 changed files with 10 additions and 5 deletions

View File

@ -1,9 +1,10 @@
/*
** Copyright 2002-2004, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
** Distributed under the terms of the OpenBeOS License.
*/
* Copyright 2002-2007, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
* Distributed under the terms of the OpenBeOS License.
*/
#include <errno.h>
#include <poll.h>
#include <syscalls.h>
@ -11,6 +12,10 @@
int
poll(struct pollfd *fds, nfds_t numfds, int timeout)
{
return _kern_poll(fds, numfds, timeout * 1000LL);
int result = _kern_poll(fds, numfds, timeout * 1000LL);
if (result < 0) {
errno = result;
return -1;
}
return result;
}