about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2022-08-10 14:56:35 +0000
committerLaurent Bercot <ska@appnovation.com>2022-08-10 14:56:35 +0000
commit775b68f68395936980d503edd22dd6bcd3bb05c2 (patch)
tree79d2548f67e583f9e55261c4694dcce1ffad0379
parente35bc72c6f8214dbcb9105bb0268aaa86b602e9e (diff)
downloadmdevd-775b68f68395936980d503edd22dd6bcd3bb05c2.tar.gz
mdevd-775b68f68395936980d503edd22dd6bcd3bb05c2.tar.xz
mdevd-775b68f68395936980d503edd22dd6bcd3bb05c2.zip
Fix the refactor... handle_event() modifies event, duh.
Signed-off-by: Laurent Bercot <ska@appnovation.com>
-rw-r--r--src/mdevd/mdevd.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/mdevd/mdevd.c b/src/mdevd/mdevd.c
index 5559225..0a3afcb 100644
--- a/src/mdevd/mdevd.c
+++ b/src/mdevd/mdevd.c
@@ -1022,17 +1022,15 @@ int main (int argc, char const *const *argv)
 
       while (ud.pid || cont == 2)
       {
-        int done = 0 ;
         if (iopause_stamp(x, 1 + (!ud.pid && cont == 2), 0, 0) < 0) strerr_diefu1sys(111, "iopause") ;
-        if (x[0].revents & IOPAUSE_READ)
-          done |= handle_signals(&event, script, scriptlen, storage, envmatch, &ud) ;
-        if (!ud.pid && cont == 2 && x[1].revents & IOPAUSE_READ)
-          done |= handle_event(x[1].fd, &event, script, scriptlen, storage, envmatch, &ud) ;
-        if (done)
-        {
-          if (outputfd && !output_event(outputfd, &event)) outputfd = 0 ;
-          if (rebc) rebc_event(rebc, &event) ;
-        }
+        if (x[0].revents & IOPAUSE_READ && handle_signals(&event, script, scriptlen, storage, envmatch, &ud))
+          goto dorebc ;
+        if (!ud.pid && cont == 2 && x[1].revents & IOPAUSE_READ && handle_event(x[1].fd, &event, script, scriptlen, storage, envmatch, &ud))
+          goto dorebc ;
+        continue ;
+       dorebc:
+        if (outputfd && !output_event(outputfd, &event)) outputfd = 0 ;
+        if (rebc) rebc_event(rebc, &event) ;
       }
 
       script_free(script, scriptlen, envmatch, envmatchlen) ;