mirror of
https://github.com/postgres/postgres.git
synced 2025-10-24 01:29:19 +03:00
Remove check for accept() argument types
This check was used to accommodate a staggering variety in particular in the type of the third argument of accept(). This is no longer of concern on currently supported systems. We can just use socklen_t in the code and put in a simple check that substitutes int for socklen_t if it's missing, to cover the few stragglers. Reviewed-by: Andres Freund <andres@anarazel.de> Discussion: https://www.postgresql.org/message-id/3538f4c4-1886-64f2-dcff-aaad8267fb82@enterprisedb.com
This commit is contained in:
@@ -37,7 +37,7 @@ getpeereid(int sock, uid_t *uid, gid_t *gid)
|
||||
#if defined(SO_PEERCRED)
|
||||
/* Linux: use getsockopt(SO_PEERCRED) */
|
||||
struct ucred peercred;
|
||||
ACCEPT_TYPE_ARG3 so_len = sizeof(peercred);
|
||||
socklen_t so_len = sizeof(peercred);
|
||||
|
||||
if (getsockopt(sock, SOL_SOCKET, SO_PEERCRED, &peercred, &so_len) != 0 ||
|
||||
so_len != sizeof(peercred))
|
||||
@@ -48,7 +48,7 @@ getpeereid(int sock, uid_t *uid, gid_t *gid)
|
||||
#elif defined(LOCAL_PEERCRED)
|
||||
/* Debian with FreeBSD kernel: use getsockopt(LOCAL_PEERCRED) */
|
||||
struct xucred peercred;
|
||||
ACCEPT_TYPE_ARG3 so_len = sizeof(peercred);
|
||||
socklen_t so_len = sizeof(peercred);
|
||||
|
||||
if (getsockopt(sock, 0, LOCAL_PEERCRED, &peercred, &so_len) != 0 ||
|
||||
so_len != sizeof(peercred) ||
|
||||
|
||||
Reference in New Issue
Block a user