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

initialize msghdr portably #77

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

initialize msghdr portably #77

wants to merge 1 commit into from

Conversation

kraj
Copy link

@kraj kraj commented Sep 1, 2022

on linux we have musl as an option for system C library and current
initialization assumes the structure to be same as glibc, therefore
initialize the elements of structure instead, so it can work on both
glibc and musl.

Fixes
net.c:115:79: error: incompatible pointer to integer conversion initializing 'int' with an expression of type 'void *' [-Wint-conversion]
struct msghdr s_msg = { (void *)&s_sa, sizeof(struct sockaddr_nl), s_io, 1, NULL, 0, 0};
^~~~

Signed-off-by: Khem Raj raj.khem@gmail.com

on linux we have musl as an option for system C library and current
initialization assumes the structure to be same as glibc, therefore
initialize the elements of structure instead, so it can work on both
glibc and musl.

Fixes
net.c:115:79: error: incompatible pointer to integer conversion initializing 'int' with an expression of type 'void *' [-Wint-conversion]
        struct msghdr           s_msg = { (void *)&s_sa, sizeof(struct sockaddr_nl), s_io, 1, NULL, 0, 0};
                                                                                              ^~~~

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants