um: sigio: Return error from add_sigio_fd()

If we run out of space, return an error instead of 0.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
This commit is contained in:
Johannes Berg 2020-11-23 20:44:02 +01:00 committed by Richard Weinberger
parent ef3ba87cb7
commit d66c91836b

View File

@ -167,15 +167,17 @@ static void update_thread(void)
int add_sigio_fd(int fd)
{
struct pollfd *p;
int err = 0, i, n;
int err, i, n;
sigio_lock();
for (i = 0; i < all_sigio_fds.used; i++) {
if (all_sigio_fds.poll[i].fd == fd)
break;
}
if (i == all_sigio_fds.used)
if (i == all_sigio_fds.used) {
err = -ENOSPC;
goto out;
}
p = &all_sigio_fds.poll[i];