From e8cae7424e59912b383c6d449ea9f9b396efd632 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Fri, 12 Oct 2007 16:49:56 +0000 Subject: [PATCH] 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 --- src/system/libroot/posix/poll.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/system/libroot/posix/poll.c b/src/system/libroot/posix/poll.c index 44b936e0e1..aaea2fbaf5 100644 --- a/src/system/libroot/posix/poll.c +++ b/src/system/libroot/posix/poll.c @@ -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 #include #include @@ -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; } -