mirror of
git://git.code.sf.net/p/xtables-addons/xtables-addons
synced 2025-09-06 20:55:13 +02:00
pknlusr: tidy up initialization of local address
Use struct initialization and drop memset. We do not need to set the port ID, since the kernel will do it for us. Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
This commit is contained in:

committed by
Jan Engelhardt

parent
b4faa4de65
commit
9cd0b44c81
@@ -16,7 +16,7 @@ int main(void)
|
|||||||
{
|
{
|
||||||
int status;
|
int status;
|
||||||
int group = GROUP;
|
int group = GROUP;
|
||||||
struct sockaddr_nl local_addr;
|
struct sockaddr_nl local_addr = {.nl_family = AF_NETLINK};
|
||||||
int sock_fd, buf_size;
|
int sock_fd, buf_size;
|
||||||
unsigned char *buf;
|
unsigned char *buf;
|
||||||
|
|
||||||
@@ -27,9 +27,6 @@ int main(void)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(&local_addr, 0, sizeof(local_addr));
|
|
||||||
local_addr.nl_family = AF_NETLINK;
|
|
||||||
local_addr.nl_pid = getpid();
|
|
||||||
local_addr.nl_groups = group;
|
local_addr.nl_groups = group;
|
||||||
status = bind(sock_fd, (struct sockaddr *)&local_addr, sizeof(local_addr));
|
status = bind(sock_fd, (struct sockaddr *)&local_addr, sizeof(local_addr));
|
||||||
if (status == -1) {
|
if (status == -1) {
|
||||||
|
Reference in New Issue
Block a user