summaryrefslogtreecommitdiffstats
path: root/zebra/ipforward_solaris.c
diff options
context:
space:
mode:
Diffstat (limited to 'zebra/ipforward_solaris.c')
-rw-r--r--zebra/ipforward_solaris.c52
1 files changed, 30 insertions, 22 deletions
diff --git a/zebra/ipforward_solaris.c b/zebra/ipforward_solaris.c
index 8d0618aa..27a3afde 100644
--- a/zebra/ipforward_solaris.c
+++ b/zebra/ipforward_solaris.c
@@ -44,6 +44,7 @@ extern struct zebra_privs_t zserv_privs;
** name of the parameter being referenced.
*/
+
static int
solaris_nd(const int cmd, const char* parameter, const int value)
{
@@ -74,33 +75,40 @@ solaris_nd(const int cmd, const char* parameter, const int value)
if ( zserv_privs.change (ZPRIVS_RAISE) )
zlog_err ("solaris_nd: Can't raise privileges");
- if ((fd = open (device, O_RDWR)) < 0) {
- zlog_warn("failed to open device %s - %s", device, strerror(errno));
- if ( zserv_privs.change (ZPRIVS_LOWER) )
- zlog_err ("solaris_nd: Can't lower privileges");
- return -1;
- }
- if (ioctl (fd, I_STR, &strioctl) < 0) {
- if ( zserv_privs.change (ZPRIVS_LOWER) )
- zlog_err ("solaris_nd: Can't lower privileges");
- close (fd);
- zlog_warn("ioctl I_STR failed on device %s - %s", device,strerror(errno));
- return -1;
- }
+ if ((fd = open (device, O_RDWR)) < 0)
+ {
+ zlog_warn("failed to open device %s - %s", device, strerror(errno));
+ if ( zserv_privs.change (ZPRIVS_LOWER) )
+ zlog_err ("solaris_nd: Can't lower privileges");
+ return -1;
+ }
+ if (ioctl (fd, I_STR, &strioctl) < 0)
+ {
+ if ( zserv_privs.change (ZPRIVS_LOWER) )
+ zlog_err ("solaris_nd: Can't lower privileges");
+ close (fd);
+ zlog_warn("ioctl I_STR failed on device %s - %s", device,strerror(errno));
+ return -1;
+ }
close(fd);
if ( zserv_privs.change (ZPRIVS_LOWER) )
zlog_err ("solaris_nd: Can't lower privileges");
- if (cmd == ND_GET) {
- errno = 0;
- retval = atoi(nd_buf);
- if (errno) {
- zlog_warn("failed to convert returned value to integer - %s",strerror(errno));
- retval = -1;
+ if (cmd == ND_GET)
+ {
+ errno = 0;
+ retval = atoi(nd_buf);
+ if (errno)
+ {
+ zlog_warn("failed to convert returned value to integer - %s",
+ strerror(errno));
+ retval = -1;
+ }
+ }
+ else
+ {
+ retval = 0;
}
- } else {
- retval = 0;
- }
return retval;
}