From 87a6788e6d67b8154ca9f4bc823ee831317783ef Mon Sep 17 00:00:00 2001 From: Marc Kleine-Budde Date: Mon, 28 Aug 2023 16:06:45 +0200 Subject: [PATCH 1/2] cansequence: do_send(): fix errno check "errno" hold the positive error value. Link: https://github.com/linux-can/can-utils/issues/448 Reported-by: Adien Akhmad Suggested-by: Oliver Hartkopp Fixes: fb5903f226e6 ("[cansequece] added various improvements") Signed-off-by: Marc Kleine-Budde --- cansequence.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cansequence.c b/cansequence.c index 85444d36..be3a26ce 100644 --- a/cansequence.c +++ b/cansequence.c @@ -223,7 +223,7 @@ static void do_send() } err = poll(fds, 1, 1000); - if (err == 0 || (err == -1 && errno != -EINTR)) { + if (err == 0 || (err == -1 && errno != EINTR)) { perror("poll()"); exit(EXIT_FAILURE); } From 87e6af10256cae381098230cf92aa6af7ca52697 Mon Sep 17 00:00:00 2001 From: Marc Kleine-Budde Date: Mon, 28 Aug 2023 16:09:25 +0200 Subject: [PATCH 2/2] j1939cat: do_send(): fix errno check "errno" hold the positive error value. Link: https://github.com/linux-can/can-utils/issues/448 Fixes: cc155d2f63da ("j1939cat: make use of new RX UAPI") Fixes: 19d41bec457b ("jcat: allow to re-send rest of the buffer if we was interrupted") Signed-off-by: Marc Kleine-Budde --- j1939cat.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/j1939cat.c b/j1939cat.c index 4234aad4..3383888a 100644 --- a/j1939cat.c +++ b/j1939cat.c @@ -369,7 +369,7 @@ static int j1939cat_send_loop(struct j1939cat_priv *priv, int out_fd, char *buf, ret = poll(&fds, 1, priv->polltimeout); if (ret == -1) { - if (errno == -EINTR) + if (errno == EINTR) continue; else return -errno; @@ -575,7 +575,7 @@ static int j1939cat_recv(struct j1939cat_priv *priv) ret = poll(&fds, 1, priv->polltimeout); if (ret == -1) { - if (errno == -EINTR) + if (errno == EINTR) continue; else return -errno;