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

Portability issue with inet_aton on FreeBSD 13.2 #22549

Open
mppf opened this issue Jun 14, 2023 · 3 comments
Open

Portability issue with inet_aton on FreeBSD 13.2 #22549

mppf opened this issue Jun 14, 2023 · 3 comments

Comments

@mppf
Copy link
Member

mppf commented Jun 14, 2023

In compiling Chapel 1.31 (pre-release) on FreeBSD 13.2, I see this warning:

sys.c:124:12: warning: call to undeclared function 'inet_aton'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    return inet_aton(host, &addr_inet->sin_addr);
           ^
1 warning generated.

I looked at a few simple things before timing out on the issue:

  • #define _BSD_SOURCE does not seem to help
  • adding more #includes does not seem to help.

I've created this issue to keep track of the issue and its solution.

@mppf mppf changed the title Portability issue inet_aton on FreeBSD 13.2 Portability issue with inet_aton on FreeBSD 13.2 Jun 14, 2023
@EduardoMorras
Copy link

EduardoMorras commented Dec 26, 2024

To fix it change the line to use inet_pton. I use this since 1.31, Should I send a pull request?

runtime/src/qui/sys.c line 113and forward.

int sys_set_sys_sockaddr_t(sys_sockaddr_t* addr, const char* host, u_int16_t port, int family)
{
if(family == AF_INET){
struct sockaddr_in *addr_inet = (struct sockaddr_in *)&addr->addr;
addr_inet->sin_family = AF_INET;
addr_inet->sin_port = htons(port);
++ return inet_pton(AF_INET, host, &addr_inet->sin_addr);
-- return inet_aton(host, &addr_inet->sin_addr);
}

@mppf
Copy link
Member Author

mppf commented Jan 2, 2025

@EduardoMorras - thanks very much for figuring it out. Yes, a PR would be greatly appreciated.

@EduardoMorras
Copy link

PR done. Not signed.

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

No branches or pull requests

2 participants