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

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