summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/dev/mlx/mlx.c2
-rw-r--r--usr.sbin/mlxcontrol/command.c2
-rw-r--r--usr.sbin/mlxcontrol/interface.c8
3 files changed, 7 insertions, 5 deletions
diff --git a/sys/dev/mlx/mlx.c b/sys/dev/mlx/mlx.c
index 76205e1..c7c7be7f 100644
--- a/sys/dev/mlx/mlx.c
+++ b/sys/dev/mlx/mlx.c
@@ -760,7 +760,7 @@ mlx_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int32_t flag, struct threa
if (sc->mlx_sysdrive[i].ms_disk != 0) {
/* looking for the next one we come across? */
if (*arg == -1) {
- *arg = device_get_unit(sc->mlx_sysdrive[0].ms_disk);
+ *arg = device_get_unit(sc->mlx_sysdrive[i].ms_disk);
return(0);
}
/* we want the one after this one */
diff --git a/usr.sbin/mlxcontrol/command.c b/usr.sbin/mlxcontrol/command.c
index a364767..a7dc88f 100644
--- a/usr.sbin/mlxcontrol/command.c
+++ b/usr.sbin/mlxcontrol/command.c
@@ -628,7 +628,7 @@ cmd_rebuild(int argc, char *argv[])
warnx("drive rebuild or consistency check is already in progress on this controller");
break;
default:
- warn("ioctl MLXD_CHECKASYNC");
+ warn("ioctl MLXD_REBUILDASYNC");
}
}
return(0);
diff --git a/usr.sbin/mlxcontrol/interface.c b/usr.sbin/mlxcontrol/interface.c
index 5cbf7b6..2c7e12b 100644
--- a/usr.sbin/mlxcontrol/interface.c
+++ b/usr.sbin/mlxcontrol/interface.c
@@ -79,16 +79,18 @@ void
mlxd_foreach_ctrlr(int unit, void *arg)
{
struct mlxd_foreach_action *ma = (struct mlxd_foreach_action *)arg;
- int i, fd;
+ int i, fd, ctrlfd;
/* Get the device */
- if ((fd = open(ctrlrpath(unit), 0)) < 0)
+ if ((ctrlfd = open(ctrlrpath(unit), 0)) < 0)
return;
for (i = -1; ;) {
/* Get the unit number of the next child device */
- if (ioctl(fd, MLX_NEXT_CHILD, &i) < 0)
+ if (ioctl(ctrlfd, MLX_NEXT_CHILD, &i) < 0) {
+ close(ctrlfd);
return;
+ }
/* check that we can open this unit */
if ((fd = open(drivepath(i), 0)) >= 0)
OpenPOWER on IntegriCloud