summaryrefslogtreecommitdiff
path: root/arch/um/os-Linux
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2020-11-23 20:44:02 +0100
committerRichard Weinberger <richard@nod.at>2020-12-13 22:22:01 +0100
commitd66c91836b8d7df3b6f0fe7f0c7617d28ebfcb4c (patch)
treea0953ea75871cf93694a1ee5df30ab43bb95732f /arch/um/os-Linux
parentef3ba87cb7c911bb5073e9ad30c4b37369e1a060 (diff)
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>
Diffstat (limited to 'arch/um/os-Linux')
-rw-r--r--arch/um/os-Linux/sigio.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/arch/um/os-Linux/sigio.c b/arch/um/os-Linux/sigio.c
index 75558080d0bf..f91fd16e9911 100644
--- a/arch/um/os-Linux/sigio.c
+++ b/arch/um/os-Linux/sigio.c
@@ -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];