diff options
author | Zhou Zhengping <johnzzpcrystal@gmail.com> | 2016-06-24 06:33:16 +0800 |
---|---|---|
committer | Jeff Darcy <jdarcy@redhat.com> | 2016-07-10 18:59:04 -0700 |
commit | b2c73cbf423de6201f956f522b7429615c88869d (patch) | |
tree | 361b5d97f769816c67b07f216e92127e30b4ab1f /rpc | |
parent | 30ff5b69883537f743e38f060d4d8e229a84863a (diff) |
rpc: invalid argument when function setsockopt sets option TCP_USER_TIMEOUT
If option "transport.tcp-user-timeout" hasn't been setted, glusterd's
priv->timeout will be -1, which will cause invalid argument when
set TCP_USER_TIMEOUT.
Change-Id: Ibc16264ceac0e69ab4a217ffa27c549b9fa21df9
BUG: 1349657
Signed-off-by: Zhou Zhengping <johnzzpcrystal@gmail.com>
Reviewed-on: http://review.gluster.org/14785
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Smoke: Gluster Build System <jenkins@build.gluster.org>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Diffstat (limited to 'rpc')
-rw-r--r-- | rpc/rpc-transport/socket/src/socket.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/rpc/rpc-transport/socket/src/socket.c b/rpc/rpc-transport/socket/src/socket.c index e4f72cd8bdc..3aae10bd501 100644 --- a/rpc/rpc-transport/socket/src/socket.c +++ b/rpc/rpc-transport/socket/src/socket.c @@ -865,6 +865,8 @@ __socket_keepalive (int fd, int family, int keepalive_intvl, } #if defined(TCP_USER_TIMEOUT) + if (timeout_ms < 0) + goto done; ret = setsockopt (fd, IPPROTO_TCP , TCP_USER_TIMEOUT, &timeout_ms, sizeof (timeout_ms)); if (ret == -1) { |