]> granicus.if.org Git - libtirpc/commitdiff
tirpc: Fix compiler error on rhel 5.5
authorAllison Henderson <achender@linux.vnet.ibm.com>
Wed, 14 Nov 2012 18:32:11 +0000 (13:32 -0500)
committerSteve Dickson <steved@redhat.com>
Wed, 14 Nov 2012 18:36:38 +0000 (13:36 -0500)
When compiled on rhel 5.5, the build fails due to a missing
SOCK_CLOEXEC flag that is not available in the downstream kernel.
This patch corrects this error by checking to see if the flag is
present before using it

Signed-off-by: Allison Henderson <achender@linux.vnet.ibm.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
src/rpc_soc.c

index 63d2197da3bb39052a8f8d340d3e6c5054cc8fd3..4213ca07a3705d1193157d40c9348d2fd1e92fb6 100644 (file)
@@ -104,6 +104,7 @@ clnt_com_create(raddr, prog, vers, sockp, sendsz, recvsz, tp, flags)
        if (fd == RPC_ANYSOCK) {
                static int have_cloexec;
                fd = __rpc_nconf2fd_flags(nconf, flags);
+#ifdef SOCK_CLOEXEC
                if (fd == -1) {
                        if ((flags & SOCK_CLOEXEC) && have_cloexec <= 0) {
                                fd = __rpc_nconf2fd(nconf);
@@ -117,6 +118,10 @@ clnt_com_create(raddr, prog, vers, sockp, sendsz, recvsz, tp, flags)
                                goto syserror;
                } else if (flags & SOCK_CLOEXEC)
                        have_cloexec = 1;
+#else
+               if (fd == -1)
+                       goto syserror;
+#endif
                madefd = TRUE;
        }