Blame SOURCES/Simplify-setting-NONBLOCK-on-socket.patch

68bf20
From 6d12deeb19cc2e231463427db27f8755649450d1 Mon Sep 17 00:00:00 2001
1f3433
From: Alexander Scheel <alexander.m.scheel@gmail.com>
1f3433
Date: Thu, 14 Sep 2017 10:57:12 -0500
1f3433
Subject: [PATCH] Simplify setting NONBLOCK on socket
1f3433
1f3433
Signed-off-by: Alexander Scheel <alexander.m.scheel@gmail.com>
1f3433
Reviewed-by: Simo Sorce <simo@redhat.com>
1f3433
Reviewed-by: Robbie Harwood <rharwood@redhat.com>
1f3433
Merges: #213
1f3433
[rharwood@redhat.com: fixup commit message]
1f3433
(cherry picked from commit ec808ee6a5e6746ed35acc865f253425701be352)
1f3433
---
1f3433
 proxy/src/client/gpm_common.c | 15 +--------------
1f3433
 1 file changed, 1 insertion(+), 14 deletions(-)
1f3433
1f3433
diff --git a/proxy/src/client/gpm_common.c b/proxy/src/client/gpm_common.c
1f3433
index d0f99d6..7d1158e 100644
1f3433
--- a/proxy/src/client/gpm_common.c
1f3433
+++ b/proxy/src/client/gpm_common.c
1f3433
@@ -80,7 +80,6 @@ static int gpm_open_socket(struct gpm_ctx *gpmctx)
1f3433
     struct sockaddr_un addr = {0};
1f3433
     char name[PATH_MAX];
1f3433
     int ret;
1f3433
-    unsigned flags;
1f3433
     int fd = -1;
1f3433
 
1f3433
     ret = get_pipe_name(name);
1f3433
@@ -92,24 +91,12 @@ static int gpm_open_socket(struct gpm_ctx *gpmctx)
1f3433
     strncpy(addr.sun_path, name, sizeof(addr.sun_path)-1);
1f3433
     addr.sun_path[sizeof(addr.sun_path)-1] = '\0';
1f3433
 
1f3433
-    fd = socket(AF_UNIX, SOCK_STREAM, 0);
1f3433
+    fd = socket(AF_UNIX, SOCK_STREAM | SOCK_NONBLOCK, 0);
1f3433
     if (fd == -1) {
1f3433
         ret = errno;
1f3433
         goto done;
1f3433
     }
1f3433
 
1f3433
-    ret = fcntl(fd, F_GETFD, &flags);
1f3433
-    if (ret != 0) {
1f3433
-        ret = errno;
1f3433
-        goto done;
1f3433
-    }
1f3433
-
1f3433
-    ret = fcntl(fd, F_SETFD, flags | O_NONBLOCK);
1f3433
-    if (ret != 0) {
1f3433
-        ret = errno;
1f3433
-        goto done;
1f3433
-    }
1f3433
-
1f3433
     ret = connect(fd, (struct sockaddr *)&addr, sizeof(addr));
1f3433
     if (ret == -1) {
1f3433
         ret = errno;