diff options
Diffstat (limited to 'zebra/ioctl.c')
-rw-r--r-- | zebra/ioctl.c | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/zebra/ioctl.c b/zebra/ioctl.c index eca0e769..e28d359e 100644 --- a/zebra/ioctl.c +++ b/zebra/ioctl.c @@ -46,8 +46,8 @@ int if_ioctl (u_long request, caddr_t buffer) { int sock; - int ret = 0; - int err = 0; + int ret; + int err; if (zserv_privs.change(ZPRIVS_RAISE)) zlog (NULL, LOG_ERR, "Can't raise privileges"); @@ -59,13 +59,10 @@ if_ioctl (u_long request, caddr_t buffer) perror ("socket"); exit (1); } - ret = ioctl (sock, request, buffer); + if ((ret = ioctl (sock, request, buffer)) < 0) + err = errno; if (zserv_privs.change(ZPRIVS_LOWER)) zlog (NULL, LOG_ERR, "Can't lower privileges"); - if (ret < 0) - { - err = errno; - } close (sock); if (ret < 0) @@ -81,8 +78,8 @@ int if_ioctl_ipv6 (u_long request, caddr_t buffer) { int sock; - int ret = 0; - int err = 0; + int ret; + int err; if (zserv_privs.change(ZPRIVS_RAISE)) zlog (NULL, LOG_ERR, "Can't raise privileges"); @@ -95,14 +92,10 @@ if_ioctl_ipv6 (u_long request, caddr_t buffer) exit (1); } - ret = ioctl (sock, request, buffer); + if ((ret = ioctl (sock, request, buffer)) < 0) + err = errno; if (zserv_privs.change(ZPRIVS_LOWER)) zlog (NULL, LOG_ERR, "Can't lower privileges"); - - if (ret < 0) - { - err = errno; - } close (sock); if (ret < 0) |