mirror of
https://repo.or.cz/socat.git
synced 2025-07-13 23:13:24 +00:00
Check which getprotobynumber_r() variant to use
This commit is contained in:
parent
33a5019b18
commit
ffa09eac00
3 changed files with 27 additions and 4 deletions
4
fdname.c
4
fdname.c
|
@ -253,14 +253,14 @@ int sockname(int fd, FILE *outfile, char style) {
|
|||
#endif
|
||||
|
||||
#if defined(SO_PROTOCOL) || defined(SO_PROTOTYPE)
|
||||
#if HAVE_GETPROTOBYNUMBER_R
|
||||
#if HAVE_GETPROTOBYNUMBER_R==1 /* Linux */
|
||||
rc = getprotobynumber_r(proto, &protoent, protoname, sizeof(protoname), &protoentp);
|
||||
if (protoentp == NULL) {
|
||||
Warn2("sockname(): getprotobynumber_r(proto=%d, ...): %s",
|
||||
proto, strerror(rc));
|
||||
}
|
||||
strncpy(protoname, protoentp->p_name, sizeof(protoname));
|
||||
#elif HAVE_GETPROTOBYNUMBER
|
||||
#elif HAVE_GETPROTOBYNUMBER_R==2 /* Solaris */
|
||||
protoentp = getprotobynumber(proto);
|
||||
strncpy(protoname, protoentp->p_name, sizeof(protoname));
|
||||
#else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue