1 From 6d12deeb19cc2e231463427db27f8755649450d1 Mon Sep 17 00:00:00 2001
2 From: Alexander Scheel <alexander.m.scheel@gmail.com>
3 Date: Thu, 14 Sep 2017 10:57:12 -0500
4 Subject: [PATCH] Simplify setting NONBLOCK on socket
6 Signed-off-by: Alexander Scheel <alexander.m.scheel@gmail.com>
7 Reviewed-by: Simo Sorce <simo@redhat.com>
8 Reviewed-by: Robbie Harwood <rharwood@redhat.com>
10 [rharwood@redhat.com: fixup commit message]
11 (cherry picked from commit ec808ee6a5e6746ed35acc865f253425701be352)
13 proxy/src/client/gpm_common.c | 15 +--------------
14 1 file changed, 1 insertion(+), 14 deletions(-)
16 diff --git a/proxy/src/client/gpm_common.c b/proxy/src/client/gpm_common.c
17 index d0f99d6..7d1158e 100644
18 --- a/proxy/src/client/gpm_common.c
19 +++ b/proxy/src/client/gpm_common.c
20 @@ -80,7 +80,6 @@ static int gpm_open_socket(struct gpm_ctx *gpmctx)
21 struct sockaddr_un addr = {0};
27 ret = get_pipe_name(name);
28 @@ -92,24 +91,12 @@ static int gpm_open_socket(struct gpm_ctx *gpmctx)
29 strncpy(addr.sun_path, name, sizeof(addr.sun_path)-1);
30 addr.sun_path[sizeof(addr.sun_path)-1] = '\0';
32 - fd = socket(AF_UNIX, SOCK_STREAM, 0);
33 + fd = socket(AF_UNIX, SOCK_STREAM | SOCK_NONBLOCK, 0);
39 - ret = fcntl(fd, F_GETFD, &flags);
45 - ret = fcntl(fd, F_SETFD, flags | O_NONBLOCK);
51 ret = connect(fd, (struct sockaddr *)&addr, sizeof(addr));