summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
authorKeith M Wesolowski <wesolows@foobazco.org>2014-05-16 17:57:38 +0000
committerRobert Mustacchi <rm@joyent.com>2014-07-23 08:31:48 -0700
commitceec9e142e4fe8e2388e7bd73fa65809ab1b0715 (patch)
treeca471ef13e5b1ffa6189ad1aecb7f24b4cc0ad31 /usr/src
parent81b60dac72578dc6fa8b5be0b69548c8ebba1da8 (diff)
downloadillumos-joyent-ceec9e142e4fe8e2388e7bd73fa65809ab1b0715.tar.gz
5010 ipdadm should check ipd_open return
Reviewed by: Robert Mustacchi <rm@joyent.com> Approved by: Richard Lowe <richlowe@richlowe.net>
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/cmd/ipdadm/ipdadm.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/usr/src/cmd/ipdadm/ipdadm.c b/usr/src/cmd/ipdadm/ipdadm.c
index ca68541690..4f222be9b0 100644
--- a/usr/src/cmd/ipdadm/ipdadm.c
+++ b/usr/src/cmd/ipdadm/ipdadm.c
@@ -119,6 +119,11 @@ ipdadm_list(int argc, char *argv[])
}
fd = ipd_open(NULL);
+ if (fd < 0) {
+ (void) fprintf(stderr, "%s: failed to open ipd ctl node: %s\n",
+ g_pname, ipd_errmsg);
+ return (E_ERROR);
+ }
rval = ipd_status_read(fd, &hdl);
(void) ipd_close(fd);
@@ -146,6 +151,11 @@ ipdadm_info(int argc, char *argv[])
return (usage(stderr));
fd = ipd_open(NULL);
+ if (fd < 0) {
+ (void) fprintf(stderr, "%s: failed to open ipd ctl node: %s\n",
+ g_pname, ipd_errmsg);
+ return (E_ERROR);
+ }
rval = ipd_status_read(fd, &hdl);
(void) ipd_close(fd);
if (rval != 0) {
@@ -231,6 +241,11 @@ ipdadm_corrupt(int argc, char *argv[])
ic.ic_corrupt = val;
fd = ipd_open(NULL);
+ if (fd < 0) {
+ (void) fprintf(stderr, "%s: failed to open ipd ctl node: %s\n",
+ g_pname, ipd_errmsg);
+ return (E_ERROR);
+ }
rval = ipd_ctl(fd, g_zid, &ic);
(void) ipd_close(fd);
@@ -262,6 +277,11 @@ ipdadm_delay(int argc, char *argv[])
ic.ic_delay = val;
fd = ipd_open(NULL);
+ if (fd < 0) {
+ (void) fprintf(stderr, "%s: failed to open ipd ctl node: %s\n",
+ g_pname, ipd_errmsg);
+ return (E_ERROR);
+ }
rval = ipd_ctl(fd, g_zid, &ic);
(void) ipd_close(fd);
@@ -293,6 +313,11 @@ ipdadm_drop(int argc, char *argv[])
ic.ic_drop = val;
fd = ipd_open(NULL);
+ if (fd < 0) {
+ (void) fprintf(stderr, "%s: failed to open ipd ctl node: %s\n",
+ g_pname, ipd_errmsg);
+ return (E_ERROR);
+ }
rval = ipd_ctl(fd, g_zid, &ic);
(void) ipd_close(fd);
@@ -360,6 +385,11 @@ ipdadm_remove(int argc, char *argv[])
ic.ic_mask |= rval;
fd = ipd_open(NULL);
+ if (fd < 0) {
+ (void) fprintf(stderr, "%s: failed to open ipd ctl node: %s\n",
+ g_pname, ipd_errmsg);
+ return (E_ERROR);
+ }
rval = ipd_ctl(fd, g_zid, &ic);
(void) ipd_close(fd);
if (rval == -1) {