Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 82e4d45

Browse files
committed
Suppress platform-dependent unused-variable warning.
The local variable "sock" can be unused depending on compilation flags. But there seems no particular need for it, since the kernel calls can just as easily say port->sock instead.
1 parent 176d5ba commit 82e4d45

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/backend/libpq/auth.c

+4-5
Original file line numberDiff line numberDiff line change
@@ -1785,7 +1785,6 @@ ident_inet(hbaPort *port)
17851785
static int
17861786
auth_peer(hbaPort *port)
17871787
{
1788-
int sock = port->sock;
17891788
char ident_user[IDENT_USERNAME_MAX + 1];
17901789

17911790
#if defined(HAVE_GETPEEREID)
@@ -1795,7 +1794,7 @@ auth_peer(hbaPort *port)
17951794
struct passwd *pass;
17961795

17971796
errno = 0;
1798-
if (getpeereid(sock, &uid, &gid) != 0)
1797+
if (getpeereid(port->sock, &uid, &gid) != 0)
17991798
{
18001799
/* We didn't get a valid credentials struct. */
18011800
ereport(LOG,
@@ -1823,7 +1822,7 @@ auth_peer(hbaPort *port)
18231822
struct passwd *pass;
18241823

18251824
errno = 0;
1826-
if (getsockopt(sock, SOL_SOCKET, SO_PEERCRED, &peercred, &so_len) != 0 ||
1825+
if (getsockopt(port->sock, SOL_SOCKET, SO_PEERCRED, &peercred, &so_len) != 0 ||
18271826
so_len != sizeof(peercred))
18281827
{
18291828
/* We didn't get a valid credentials struct. */
@@ -1852,7 +1851,7 @@ auth_peer(hbaPort *port)
18521851
ucred_t *ucred;
18531852

18541853
ucred = NULL; /* must be initialized to NULL */
1855-
if (getpeerucred(sock, &ucred) == -1)
1854+
if (getpeerucred(port->sock, &ucred) == -1)
18561855
{
18571856
ereport(LOG,
18581857
(errcode_for_socket_access(),
@@ -1925,7 +1924,7 @@ auth_peer(hbaPort *port)
19251924
iov.iov_base = &buf;
19261925
iov.iov_len = 1;
19271926

1928-
if (recvmsg(sock, &msg, 0) < 0 ||
1927+
if (recvmsg(port->sock, &msg, 0) < 0 ||
19291928
cmsg->cmsg_len < sizeof(cmsgmem) ||
19301929
cmsg->cmsg_type != SCM_CREDS)
19311930
{

0 commit comments

Comments
 (0)