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 <wk@gnupg.org>
This commit is contained in:
parent
ddd0a3cf90
commit
6e57379c8e
@ -607,7 +607,7 @@ _gpgme_io_select (struct io_select_fd_s *fds, size_t nfds, int nonblock)
|
|||||||
if (fds[i].fd >= FD_SETSIZE)
|
if (fds[i].fd >= FD_SETSIZE)
|
||||||
{
|
{
|
||||||
TRACE_END (dbg_help, " -BAD- ]");
|
TRACE_END (dbg_help, " -BAD- ]");
|
||||||
gpg_err_set_errno (EBADF);
|
gpg_err_set_errno (EMFILE);
|
||||||
return TRACE_SYSRES (-1);
|
return TRACE_SYSRES (-1);
|
||||||
}
|
}
|
||||||
assert (!FD_ISSET (fds[i].fd, &readfds));
|
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)
|
if (fds[i].fd >= FD_SETSIZE)
|
||||||
{
|
{
|
||||||
TRACE_END (dbg_help, " -BAD- ]");
|
TRACE_END (dbg_help, " -BAD- ]");
|
||||||
gpg_err_set_errno (EBADF);
|
gpg_err_set_errno (EMFILE);
|
||||||
return TRACE_SYSRES (-1);
|
return TRACE_SYSRES (-1);
|
||||||
}
|
}
|
||||||
assert (!FD_ISSET (fds[i].fd, &writefds));
|
assert (!FD_ISSET (fds[i].fd, &writefds));
|
||||||
|
Loading…
Reference in New Issue
Block a user