systemd-netlogd
systemd-netlogd copied to clipboard
Question about code snippet
The following code snippet seems odd to me:
https://github.com/systemd/systemd-netlogd/blob/a7c6b83e8db156edee75e547b1c1aa8b0498c7ff/src/netlog/netlog-network.c#L137-L168
The variable sa is assigned but its value (only its size) is never used.
Should the code either look like this:
case AF_INET:
salen = sizeof(m->address.sockaddr.in);
break;
case AF_INET6:
salen = sizeof(m->address.sockaddr.in6);
break;
or should the variable be used this way:
r = sockaddr_pretty(sa, salen, true, true, &pretty);
if (r < 0)
return r;
?
yes