Skip to content
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

cmd/recv.c: Migrate from deprecated gethostbyname() to getaddrinfo() #1661

Conversation

bernhardkaindl
Copy link
Contributor

@bernhardkaindl bernhardkaindl commented Mar 27, 2023

Commit message:

cmd/recv.c: Migrate from deprecated gethostbyname() to getaddrinfo()

The Fedora review-tool runs rpmlint on the binary packages and warned
that the uftrace tool was using gethostbyname. Switching to getaddrinfo
helps to get accepted, also for later uftrace distro packaging reviews:

POSIX.1-2008 removes the specifications of gethostbyname(), gethostbyaddr(),
and h_errno, recommending the use of getaddrinfo(3) and getnameinfo(3) instead:

They return a list of addrs or hostnames, are thread-safe and optionally
allow us to also use IPv6. This 1st step continues with IPv4 and only
still tries to connect to the primary, 1st address (for a small commit).

@bernhardkaindl bernhardkaindl force-pushed the migrate-from-deprecated-gethostbyname-to-getaddrinfo branch 3 times, most recently from 0967340 to d3f0484 Compare March 27, 2023 14:20
Copy link
Owner

@namhyung namhyung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You forgot to add your Signed-off-by line at the end of the comment message.

cmds/recv.c Outdated Show resolved Hide resolved
The Fedora review-tool runs rpmlint on the binary packages and warned
that the uftrace tool was using gethostbyname. Switching to getaddrinfo
helps to get accepted, also for later uftrace distro packaging reviews:

POSIX.1-2008 removes the specifications of gethostbyname(), gethostbyaddr(),
and h_errno, recommending the use of getaddrinfo(3) and getnameinfo(3) instead:

They return a list of addrs or hostnames, are thread-safe and optionally
allow us to also use IPv6. This 1st step continues with IPv4 and only
still tries to connect to the primary, 1st address (for a small commit).

Signed-off-by: Bernhard Kaindl <contact@bernhard.kaindl.dev>
@bernhardkaindl bernhardkaindl force-pushed the migrate-from-deprecated-gethostbyname-to-getaddrinfo branch from d3f0484 to ff1fc1c Compare March 28, 2023 06:57
Copy link
Owner

@namhyung namhyung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but I have a nitpick.

cmds/recv.c Show resolved Hide resolved
@bernhardkaindl bernhardkaindl changed the title Fedora(rpmlint): Migrate from deprecated gethostbyname to getaddrinfo cmd/recv.c: Migrate from deprecated gethostbyname() to getaddrinfo() Mar 29, 2023
@bernhardkaindl
Copy link
Contributor Author

Fixed to add parentheses for sizeof for consistency as reviewed:

memset(&hints, 0, sizeof(hints));

@namhyung namhyung merged commit 9e38ba0 into namhyung:master Mar 30, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants