diff options
author | Chirag Shah <chirag@cumulusnetworks.com> | 2018-06-19 22:41:28 +0200 |
---|---|---|
committer | Quentin Young <qlyoung@cumulusnetworks.com> | 2018-08-14 22:02:05 +0200 |
commit | 313d7993a35571dabf8c2b2ecdf538b0686aae74 (patch) | |
tree | fed04413cd7b3b49cf8ce678162891bc37266de3 /ospfd/ospf_network.c | |
parent | lib: Convert zlog_err for clippy build (diff) | |
download | frr-313d7993a35571dabf8c2b2ecdf538b0686aae74.tar.xz frr-313d7993a35571dabf8c2b2ecdf538b0686aae74.zip |
ospfd: zlog_ferr facility
Ticket:CM-21333
Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'ospfd/ospf_network.c')
-rw-r--r-- | ospfd/ospf_network.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/ospfd/ospf_network.c b/ospfd/ospf_network.c index d7cca0f13..c51533865 100644 --- a/ospfd/ospf_network.c +++ b/ospfd/ospf_network.c @@ -29,6 +29,7 @@ #include "log.h" #include "sockopt.h" #include "privs.h" +#include "lib_errors.h" #include "ospfd/ospfd.h" #include "ospfd/ospf_network.h" @@ -185,10 +186,10 @@ int ospf_sock_init(struct ospf *ospf) /* silently return since VRF is not ready */ return -1; } - if (ospfd_privs.change(ZPRIVS_RAISE)) { - zlog_err("ospf_sock_init: could not raise privs, %s", - safe_strerror(errno)); - } + if (ospfd_privs.change(ZPRIVS_RAISE)) + zlog_ferr(LIB_ERR_PRIVILEGES, + "ospf_sock_init: could not raise privs, %s", + safe_strerror(errno)); ospf_sock = vrf_socket(AF_INET, SOCK_RAW, IPPROTO_OSPFIGP, ospf->vrf_id, ospf->name); @@ -196,10 +197,10 @@ int ospf_sock_init(struct ospf *ospf) int save_errno = errno; if (ospfd_privs.change(ZPRIVS_LOWER)) - zlog_err("ospf_sock_init: could not lower privs, %s", - safe_strerror(errno)); - zlog_err("ospf_read_sock_init: socket: %s", - safe_strerror(save_errno)); + zlog_ferr(LIB_ERR_PRIVILEGES, + "ospf_sock_init: could not lower privs, %s", + safe_strerror(save_errno)); + exit(1); } @@ -242,9 +243,10 @@ int ospf_sock_init(struct ospf *ospf) ospf->fd = ospf_sock; out: - if (ospfd_privs.change(ZPRIVS_LOWER)) { - zlog_err("ospf_sock_init: could not lower privs, %s", - safe_strerror(errno)); - } + if (ospfd_privs.change(ZPRIVS_LOWER)) + zlog_ferr(LIB_ERR_PRIVILEGES, + "ospf_sock_init: could not lower privs, %s", + safe_strerror(errno)); + return ret; } |