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.
This commit is contained in:
Roland McGrath 1998-11-29 11:17:25 +00:00
parent e1350332dc
commit d76240d7e5
2 changed files with 10 additions and 6 deletions

View File

@ -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
{
int on = 1;
if (setsockopt (sock, SOL_SOCKET, SO_PASSCRED, &on, sizeof (on)))
return -1;
}
#endif
return recvmsg (sock, &msg, 0);

View File

@ -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
{
int on = 1;
if (setsockopt (sock, SOL_SOCKET, SO_PASSCRED, &on, sizeof (on)))
return -1;
}
#endif
return recvmsg (sock, &msg, 0);