From 90743edeef0637c3a3432fc13b53065fbd8d30ca Mon Sep 17 00:00:00 2001 From: Xiao Jia Date: Fri, 29 Jan 2016 12:41:36 -0800 Subject: [PATCH] lkl tools: hijack lib: fix set errno EOPNOTSUPP It should be passed as a negative number to lkl_set_errno. Otherwise the application receives the error as a normal return value, and errno is not properly set. Signed-off-by: Xiao Jia --- tools/lkl/lib/hijack/hijack.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/lkl/lib/hijack/hijack.c b/tools/lkl/lib/hijack/hijack.c index 288e51a3f15c9a..9a071045f458db 100644 --- a/tools/lkl/lib/hijack/hijack.c +++ b/tools/lkl/lib/hijack/hijack.c @@ -219,7 +219,7 @@ int poll(struct pollfd *fds, nfds_t nfds, int timeout) /* FIXME: need to handle mixed case of hostfd and lklfd. */ if (lklfds && hostfds) - return lkl_set_errno(LKL_EOPNOTSUPP); + return lkl_set_errno(-LKL_EOPNOTSUPP); if (hostfds) @@ -260,7 +260,7 @@ int select(int nfds, fd_set *r, fd_set *w, fd_set *e, struct timeval *t) /* FIXME: handle mixed case of hostfd and lklfd */ if (lklfds && hostfds) - return lkl_set_errno(LKL_EOPNOTSUPP); + return lkl_set_errno(-LKL_EOPNOTSUPP); if (hostfds) return host_select(nfds, r, w, e, t); @@ -276,7 +276,7 @@ int epoll_ctl(int epollfd, int op, int fd, struct epoll_event *event) CHECK_HOST_CALL(epoll_ctl); if (is_lklfd(epollfd) != is_lklfd(fd)) - return lkl_set_errno(LKL_EOPNOTSUPP); + return lkl_set_errno(-LKL_EOPNOTSUPP); if (!is_lklfd(epollfd)) return host_epoll_ctl(epollfd, op, fd, event);