aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2016-11-10 18:49:13 +0000
committerWerner Koch <[email protected]>2016-11-10 18:49:58 +0000
commit6e57379c8e37c0863f7d12819a5a7d0781bd76d2 (patch)
treeea1856b8e7fdd4bcb6cafc7b46f0e1daf1935fe9
parenttests: Reduce thread count in new thread tests (diff)
downloadgpgme-6e57379c8e37c0863f7d12819a5a7d0781bd76d2.tar.gz
gpgme-6e57379c8e37c0863f7d12819a5a7d0781bd76d2.zip
core: Use better error code when using select with a too high fd.
* src/posix-io.c (_gpgme_io_select): Return EMFILE instead of EBADF. -- Also EBADF seem more correct, EMFILE (Too man open files) gives a clearer message to the user that there are somehow too many files open. The problem can be exhibited by running lots of threads, We should eventually move to poll but that would be a large change and so we better fix it with the planned migration of the I/O subsystem to libgpgrt (currently known as libgpg-error). Signed-off-by: Werner Koch <[email protected]>
-rw-r--r--src/posix-io.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/posix-io.c b/src/posix-io.c
index c0b2f4fa..c903072c 100644
--- a/src/posix-io.c
+++ b/src/posix-io.c
@@ -607,7 +607,7 @@ _gpgme_io_select (struct io_select_fd_s *fds, size_t nfds, int nonblock)
if (fds[i].fd >= FD_SETSIZE)
{
TRACE_END (dbg_help, " -BAD- ]");
- gpg_err_set_errno (EBADF);
+ gpg_err_set_errno (EMFILE);
return TRACE_SYSRES (-1);
}
assert (!FD_ISSET (fds[i].fd, &readfds));
@@ -622,7 +622,7 @@ _gpgme_io_select (struct io_select_fd_s *fds, size_t nfds, int nonblock)
if (fds[i].fd >= FD_SETSIZE)
{
TRACE_END (dbg_help, " -BAD- ]");
- gpg_err_set_errno (EBADF);
+ gpg_err_set_errno (EMFILE);
return TRACE_SYSRES (-1);
}
assert (!FD_ISSET (fds[i].fd, &writefds));