-
Notifications
You must be signed in to change notification settings - Fork 494
lib/gsockaddr.c: modify the unix salen calculation #2285
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
Conversation
Build SUCCESS |
It is not required on all platforms to add the size of the terminating null character (+1) to the value of the addrlen parameter during the bind system call. Most platforms has a built in MACRO to calculate the proper value, called SUN_LEN. SUN_LEN is not a POSIX standard, so we use the formula from the Linux man page if it is not available. Signed-off-by: Laszlo Szemere <[email protected]>
6444ac3
to
623c39a
Compare
Build SUCCESS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
lib/gsockaddr.c
Outdated
return sizeof(addr->saun) - sizeof(addr->saun.sun_path) + strlen(addr->saun.sun_path) + 1; | ||
#endif | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So we have a platform where SUN_LEN
is not defined? :)
I'd define SUN_LEN
in a compat
header.
What do you think?
an alternative impl.:
http://lists.llvm.org/pipermail/lldb-commits/Week-of-Mon-20151026/024736.html
Does this have the same result?
Signed-off-by: Laszlo Szemere <[email protected]>
@szemere : Thanks! |
Build SUCCESS |
It is not required on all platforms to add the size of the
terminating null character (+1) to the value of the
addrlen
parameter during the
bind
system call. Most platforms has abuilt in MACRO to calculate the proper value, called
SUN_LEN
.SUN_LEN is not a POSIX standard, so we use the formula from
the Linux man page if it is not available.
Signed-off-by: Laszlo Szemere [email protected]