Remove pointless privilege lower call. Thanks to Cougar for noticing.
diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c
index 26369dd..2ca0de4 100644
--- a/zebra/rt_netlink.c
+++ b/zebra/rt_netlink.c
@@ -122,19 +122,17 @@
}
ret = bind (sock, (struct sockaddr *) &snl, sizeof snl);
+ if (zserv_privs.change (ZPRIVS_LOWER))
+ zlog (NULL, LOG_ERR, "Can't lower privileges");
+
if (ret < 0)
{
- if (zserv_privs.change (ZPRIVS_LOWER))
- zlog (NULL, LOG_ERR, "Can't lower privileges");
zlog (NULL, LOG_ERR, "Can't bind %s socket to group 0x%x: %s",
nl->name, snl.nl_groups, strerror (errno));
close (sock);
return -1;
}
- if (zserv_privs.change (ZPRIVS_LOWER))
- zlog (NULL, LOG_ERR, "Can't lower privileges");
-
/* multiple netlink sockets will have different nl_pid */
namelen = sizeof snl;
ret = getsockname (sock, (struct sockaddr *) &snl, &namelen);