diff options
author | David Lamparter <equinox@opensourcerouting.org> | 2018-08-10 18:36:43 +0200 |
---|---|---|
committer | Quentin Young <qlyoung@cumulusnetworks.com> | 2018-08-14 22:02:05 +0200 |
commit | 01b9e3fd0d354d7d4c60b1c0240f269a4fd08990 (patch) | |
tree | 7758a10d2c803e86348e04e908f73b63c0048b96 /zebra/irdp_main.c | |
parent | lib: add frr_elevate_privs() wrapper (diff) | |
download | frr-01b9e3fd0d354d7d4c60b1c0240f269a4fd08990.tar.xz frr-01b9e3fd0d354d7d4c60b1c0240f269a4fd08990.zip |
*: use frr_elevate_privs() (1/2: coccinelle)
Signed-off-by: David Lamparter <equinox@diac24.net>
Diffstat (limited to 'zebra/irdp_main.c')
-rw-r--r-- | zebra/irdp_main.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/zebra/irdp_main.c b/zebra/irdp_main.c index 630eee592..771ae796e 100644 --- a/zebra/irdp_main.c +++ b/zebra/irdp_main.c @@ -81,18 +81,12 @@ int irdp_sock_init(void) int save_errno; int sock; - if (zserv_privs.change(ZPRIVS_RAISE)) - flog_err(LIB_ERR_PRIVILEGES, - "irdp_sock_init: could not raise privs, %s", - safe_strerror(errno)); + frr_elevate_privs(&zserv_privs) { - sock = socket(AF_INET, SOCK_RAW, IPPROTO_ICMP); - save_errno = errno; + sock = socket(AF_INET, SOCK_RAW, IPPROTO_ICMP); + save_errno = errno; - if (zserv_privs.change(ZPRIVS_LOWER)) - flog_err(LIB_ERR_PRIVILEGES, - "irdp_sock_init: could not lower privs, %s", - safe_strerror(errno)); + } if (sock < 0) { zlog_warn("IRDP: can't create irdp socket %s", |