Blame SOURCES/0002-SSS_CLIENT-fix-error-codes-returned-by-common-read-w.patch

8ea3d3
From f3333b9dbeda33a9344b458accaa4ff372adb660 Mon Sep 17 00:00:00 2001
8ea3d3
From: Alexey Tikhonov <atikhono@redhat.com>
8ea3d3
Date: Fri, 3 Feb 2023 11:35:42 +0100
8ea3d3
Subject: [PATCH 2/4] SSS_CLIENT: fix error codes returned by common
8ea3d3
 read/write/check helpers.
8ea3d3
MIME-Version: 1.0
8ea3d3
Content-Type: text/plain; charset=UTF-8
8ea3d3
Content-Transfer-Encoding: 8bit
8ea3d3
8ea3d3
It's kind of expected that in case `(POLLERR | POLLHUP | POLLNVAL)`
8ea3d3
error condition is detected, regular `POLLIN/POLLOUT` won't be set.
8ea3d3
Error code set by error condition should have a priority. This enables
8ea3d3
users of this helper to retry attempt (as designed).
8ea3d3
8ea3d3
Reviewed-by: Pavel Březina <pbrezina@redhat.com>
8ea3d3
Reviewed-by: Sumit Bose <sbose@redhat.com>
8ea3d3
(cherry picked from commit 0b8638d8de435384562f17d041655887b73523cd)
8ea3d3
---
8ea3d3
 src/sss_client/common.c | 9 +++------
8ea3d3
 1 file changed, 3 insertions(+), 6 deletions(-)
8ea3d3
8ea3d3
diff --git a/src/sss_client/common.c b/src/sss_client/common.c
8ea3d3
index 2c888faa9..27e09f6f3 100644
8ea3d3
--- a/src/sss_client/common.c
8ea3d3
+++ b/src/sss_client/common.c
8ea3d3
@@ -161,8 +161,7 @@ static enum sss_status sss_cli_send_req(enum sss_cli_command cmd,
8ea3d3
         case 1:
8ea3d3
             if (pfd.revents & (POLLERR | POLLHUP | POLLNVAL)) {
8ea3d3
                 *errnop = EPIPE;
8ea3d3
-            }
8ea3d3
-            if (!(pfd.revents & POLLOUT)) {
8ea3d3
+            } else if (!(pfd.revents & POLLOUT)) {
8ea3d3
                 *errnop = EBUSY;
8ea3d3
             }
8ea3d3
             break;
8ea3d3
@@ -273,8 +272,7 @@ static enum sss_status sss_cli_recv_rep(enum sss_cli_command cmd,
8ea3d3
             }
8ea3d3
             if (pfd.revents & (POLLERR | POLLNVAL)) {
8ea3d3
                 *errnop = EPIPE;
8ea3d3
-            }
8ea3d3
-            if (!(pfd.revents & POLLIN)) {
8ea3d3
+            } else if (!(pfd.revents & POLLIN)) {
8ea3d3
                 *errnop = EBUSY;
8ea3d3
             }
8ea3d3
             break;
8ea3d3
@@ -725,8 +723,7 @@ static enum sss_status sss_cli_check_socket(int *errnop,
8ea3d3
         case 1:
8ea3d3
             if (pfd.revents & (POLLERR | POLLHUP | POLLNVAL)) {
8ea3d3
                 *errnop = EPIPE;
8ea3d3
-            }
8ea3d3
-            if (!(pfd.revents & (POLLIN | POLLOUT))) {
8ea3d3
+            } else if (!(pfd.revents & (POLLIN | POLLOUT))) {
8ea3d3
                 *errnop = EBUSY;
8ea3d3
             }
8ea3d3
             break;
8ea3d3
-- 
8ea3d3
2.37.3
8ea3d3