From 59e7d2d70f9f97bd55ccb36b161a39b7492262e0 Mon Sep 17 00:00:00 2001
From: Jeremy Soller <jackpot51@gmail.com>
Date: Mon, 6 May 2024 14:29:21 -0600
Subject: [PATCH] Return 0 when epoll_ctl is successful

---
 src/platform/redox/epoll.rs | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/src/platform/redox/epoll.rs b/src/platform/redox/epoll.rs
index 6fb98170..9ec4be65 100644
--- a/src/platform/redox/epoll.rs
+++ b/src/platform/redox/epoll.rs
@@ -23,7 +23,7 @@ impl PalEpoll for Sys {
     fn epoll_ctl(epfd: c_int, op: c_int, fd: c_int, event: *mut epoll_event) -> c_int {
         match op {
             EPOLL_CTL_ADD | EPOLL_CTL_MOD => {
-                Sys::write(
+                if Sys::write(
                     epfd,
                     &Event {
                         id: fd as usize,
@@ -33,10 +33,15 @@ impl PalEpoll for Sys {
                         // systems. If this is needed, use a box or something
                         data: unsafe { (*event).data.u64 as usize },
                     },
-                ) as c_int
+                ) < 0
+                {
+                    -1
+                } else {
+                    0
+                }
             }
             EPOLL_CTL_DEL => {
-                Sys::write(
+                if Sys::write(
                     epfd,
                     &Event {
                         id: fd as usize,
@@ -44,11 +49,16 @@ impl PalEpoll for Sys {
                         //TODO: Is data required?
                         data: 0,
                     },
-                ) as c_int
+                ) < 0
+                {
+                    -1
+                } else {
+                    0
+                }
             }
             _ => {
                 platform::ERRNO.set(EINVAL);
-                return -1;
+                -1
             }
         }
     }
-- 
GitLab