about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1998-11-29 11:17:25 +0000
committerRoland McGrath <roland@gnu.org>1998-11-29 11:17:25 +0000
commitd76240d7e570d785b8b45207482858ad7c8dab71 (patch)
tree9662ac8a23c092a60de2359f40e46627c20b807b
parente1350332dcddd748d7f8ed2a7c0d08e5a88b27fe (diff)
downloadglibc-d76240d7e570d785b8b45207482858ad7c8dab71.tar.gz
glibc-d76240d7e570d785b8b45207482858ad7c8dab71.tar.xz
glibc-d76240d7e570d785b8b45207482858ad7c8dab71.zip
1998-11-29 Roland McGrath <roland@baalperazim.frob.com>
* sunrpc/svc_unix.c (__msgread): Move ON local var inside block 
within #ifdef SO_PASSCRED.  Avoids unused var when no SO_PASSCRED. 
* sunrpc/clnt_unix.c (__msgread): Likewise.
-rw-r--r--sunrpc/clnt_unix.c8
-rw-r--r--sunrpc/svc_unix.c8
2 files changed, 10 insertions, 6 deletions
diff --git a/sunrpc/clnt_unix.c b/sunrpc/clnt_unix.c
index 365bdace3f..cead72b761 100644
--- a/sunrpc/clnt_unix.c
+++ b/sunrpc/clnt_unix.c
@@ -445,7 +445,6 @@ __msgread (int sock, void *buf, size_t cnt)
   struct iovec iov[1];
   struct msghdr msg;
   struct cmessage cm;
-  int on = 1;
 
   iov[0].iov_base = buf;
   iov[0].iov_len = cnt;
@@ -459,8 +458,11 @@ __msgread (int sock, void *buf, size_t cnt)
   msg.msg_flags = 0;
 
 #ifdef SO_PASSCRED
-  if (setsockopt (sock, SOL_SOCKET, SO_PASSCRED, &on, sizeof (on)))
-    return -1;
+  {
+    int on = 1;
+    if (setsockopt (sock, SOL_SOCKET, SO_PASSCRED, &on, sizeof (on)))
+      return -1;
+  }
 #endif
 
   return recvmsg (sock, &msg, 0);
diff --git a/sunrpc/svc_unix.c b/sunrpc/svc_unix.c
index 0aa343654f..7ada8cc86d 100644
--- a/sunrpc/svc_unix.c
+++ b/sunrpc/svc_unix.c
@@ -295,7 +295,6 @@ __msgread (int sock, void *buf, size_t cnt)
 {
   struct iovec iov[1];
   struct msghdr msg;
-  int on = 1;
 
   iov[0].iov_base = buf;
   iov[0].iov_len = cnt;
@@ -309,8 +308,11 @@ __msgread (int sock, void *buf, size_t cnt)
   msg.msg_flags = 0;
 
 #ifdef SO_PASSCRED
-  if (setsockopt (sock, SOL_SOCKET, SO_PASSCRED, &on, sizeof (on)))
-    return -1;
+  {
+    int on = 1;
+    if (setsockopt (sock, SOL_SOCKET, SO_PASSCRED, &on, sizeof (on)))
+      return -1;
+  }
 #endif
 
   return recvmsg (sock, &msg, 0);