[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] poke: Handle `EINTR` as non-fatal error
From: |
Mohammad-Reza Nabipoor |
Subject: |
[PATCH] poke: Handle `EINTR` as non-fatal error |
Date: |
Sun, 13 Dec 2020 21:47:01 +0330 |
2020-12-13 Mohammad-Reza Nabipoor <m.nabipoor@yahoo.com>
* poke/pk-mi.c: Add include `errno.h`.
(mi_loop): Ignore `EINTR` when `select` fails. It's not a fatal error.
* poke/pk-hserver.c (hserver_thread_worker): Likewise.
---
ChangeLog | 6 ++++++
poke/pk-hserver.c | 2 ++
poke/pk-mi.c | 3 +++
3 files changed, 11 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index 146dde90..7fa69ce1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2020-12-13 Mohammad-Reza Nabipoor <m.nabipoor@yahoo.com>
+
+ * poke/pk-mi.c: Add include `errno.h`.
+ (mi_loop): Ignore `EINTR` when `select` fails. It's not a fatal error.
+ * poke/pk-hserver.c (hserver_thread_worker): Likewise.
+
2020-12-13 Mohammad-Reza Nabipoor <m.nabipoor@yahoo.com>
* libpoke/pkl-promo.c (pkl_promo_ps_struct_type_field): Skip
diff --git a/poke/pk-hserver.c b/poke/pk-hserver.c
index 2c52bb60..20311686 100644
--- a/poke/pk-hserver.c
+++ b/poke/pk-hserver.c
@@ -218,6 +218,8 @@ hserver_thread_worker (void *data)
read_fd_set = active_fd_set;
if (select (FD_SETSIZE, &read_fd_set, NULL, NULL, &timeout) < 0)
{
+ if (errno == EINTR)
+ continue;
perror ("select");
pk_fatal (NULL);
}
diff --git a/poke/pk-mi.c b/poke/pk-mi.c
index 9182d399..58e4e548 100644
--- a/poke/pk-mi.c
+++ b/poke/pk-mi.c
@@ -25,6 +25,7 @@
#include <string.h>
#include <assert.h>
#include <fcntl.h>
+#include <errno.h>
#include "poke.h"
@@ -216,6 +217,8 @@ pk_mi_loop (int fd)
if (select (FD_SETSIZE, &read_fd_set, NULL, NULL,
NULL /* timeout */) < 0)
{
+ if (errno == EINTR)
+ continue;
perror ("select");
pk_fatal (NULL);
}
--
2.29.2
- [PATCH] poke: Handle `EINTR` as non-fatal error,
Mohammad-Reza Nabipoor <=