Skip to content

gh-127081: use re-entrant variants of get{proto,serv}by{name,port} #132750

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

duaneg
Copy link

@duaneg duaneg commented Apr 20, 2025

Add configure tests and defines for getservbyname_r, getservbyport_r, and getprotobyname_r. Use these if available, otherwise fallback to the thread-unsafe variants.

Add a unit test to exercise getprotobyname, which is currently untested.

TODO:

  • Are there any platforms which define the unsafe variants but not the re-entrant ones? If not we can simplify the #ifdef hell somewhat.
  • Do the re-entrant functions have the same signature on all platforms?
  • These changes follow the existing code's practice: allocate a fixed-size (and overly large) buffer, and don't properly handle the error case if it is too small. Should this be fixed? If so should existing code also be fixed?

Add configure tests and defines for getservbyname_r, getservbyport_r, and
getprotobyname_r. Use these if available, otherwise fallback to the
thread-unsafe variants.

Add a unit test to exercise getprotobyname, which is currently untested.

TODO:
 - Are there any platforms which define the unsafe variants but not the
   re-entrant ones? If not we can simplify the #ifdef hell somewhat.
 - Do the re-entrant functions have the same signature on all platforms?
 - These changes follow the existing code's practice: allocate a fixed-size
   (and overly large) buffer, and don't properly handle the error case if it is
   too small. Should this be fixed? If so should existing code also be fixed?
@picnixz picnixz changed the title gh-127081: use re-entrant variants of get{proto,serv}by{name,port} gh-127081: use re-entrant variants of get{proto,serv}by{name,port} Apr 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant