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

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