Skip to content

Conversation

szemere
Copy link
Collaborator

@szemere szemere commented Sep 17, 2018

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]

@kira-syslogng
Copy link
Contributor

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]>
@szemere szemere force-pushed the fix_unix_domain_addrlen branch from 6444ac3 to 623c39a Compare September 17, 2018 14:29
@szemere szemere changed the title lib/gsockaddr.c: modify the unix salen calculation [WIP]: lib/gsockaddr.c: modify the unix salen calculation Sep 17, 2018
@kira-syslogng
Copy link
Contributor

Build SUCCESS

bazsi
bazsi previously approved these changes Sep 17, 2018
Copy link
Collaborator

@bazsi bazsi left a 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
}

Copy link
Collaborator

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?

@gaborznagy gaborznagy self-requested a review September 18, 2018 08:44
@lbudai
Copy link
Collaborator

lbudai commented Sep 18, 2018

@szemere : Thanks!

@kira-syslogng
Copy link
Contributor

Build SUCCESS

@gaborznagy gaborznagy changed the title [WIP]: lib/gsockaddr.c: modify the unix salen calculation lib/gsockaddr.c: modify the unix salen calculation Sep 19, 2018
@gaborznagy gaborznagy merged commit fd2ac7c into syslog-ng:master Sep 19, 2018
@lbudai lbudai added this to the OSE 3.18 milestone Sep 24, 2018
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.

5 participants