[PATCH] um: sigio: return error from add_sigio_fd()

Johannes Berg johannes at sipsolutions.net
Mon Nov 23 14:44:02 EST 2020


From: Johannes Berg <johannes.berg at intel.com>

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

Signed-off-by: Johannes Berg <johannes.berg at intel.com>
---
 arch/um/os-Linux/sigio.c | 6 ++++--
 1 file 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];
 
-- 
2.26.2




More information about the linux-um mailing list