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

Commit c981879

Browse files
committed
Don't bother to set sockaddr_un.sun_len.
It's not necessary to fill in sun_len when calling bind() or connect(), on all known systems that have it. Discussion: https://postgr.es/m/2781112.1644819528%40sss.pgh.pa.us
1 parent f972ec5 commit c981879

File tree

1 file changed

+0
-14
lines changed

1 file changed

+0
-14
lines changed

src/common/ip.c

-14
Original file line numberDiff line numberDiff line change
@@ -218,20 +218,6 @@ getaddrinfo_unix(const char *path, const struct addrinfo *hintsp,
218218
aip->ai_addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(path);
219219
}
220220

221-
/*
222-
* The standard recommendation for filling sun_len is to set it to the
223-
* struct size (independently of the actual path length). However, that
224-
* draws an integer-overflow warning on AIX 7.1, where sun_len is just
225-
* uint8 yet the struct size exceeds 255 bytes. It's likely that nothing
226-
* is paying attention to sun_len on that platform, but we have to do
227-
* something with it. To suppress the warning, clamp the struct size to
228-
* what will fit in sun_len.
229-
*/
230-
#ifdef HAVE_STRUCT_SOCKADDR_SA_LEN
231-
unp->sun_len = Min(sizeof(struct sockaddr_un),
232-
((size_t) 1 << (sizeof(unp->sun_len) * BITS_PER_BYTE)) - 1);
233-
#endif
234-
235221
return 0;
236222
}
237223

0 commit comments

Comments
 (0)