aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/mlxcontrol/interface.c
diff options
context:
space:
mode:
authorStephane E. Potvin <sepotvin@FreeBSD.org>2008-09-12 17:40:17 +0000
committerStephane E. Potvin <sepotvin@FreeBSD.org>2008-09-12 17:40:17 +0000
commit29e6fa3a7fc7488afa8f17c3f93bff4bcbcff738 (patch)
treefa6049849ab9735b9c75084f246857df36936a8f /usr.sbin/mlxcontrol/interface.c
parent3d0f3248eac46800370b58871ec49d0aa4f877f3 (diff)
downloadsrc-29e6fa3a7fc7488afa8f17c3f93bff4bcbcff738.tar.gz
src-29e6fa3a7fc7488afa8f17c3f93bff4bcbcff738.zip
Make mlxcontrol work with more than one system drive:
- When searching for the next system drive, return the next one instead of always returning the first one. - Plug fd lead and make sure that the MLX_NEXT_CHILD ioctl is called on the controller fd, not the disk's one. While there, fix a cut-n-pase error in a warning. Reviewed by: jhb Approved by: kan (mentor) MFC after: 1 month
Notes
Notes: svn path=/head/; revision=182965
Diffstat (limited to 'usr.sbin/mlxcontrol/interface.c')
-rw-r--r--usr.sbin/mlxcontrol/interface.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/usr.sbin/mlxcontrol/interface.c b/usr.sbin/mlxcontrol/interface.c
index 5cbf7b609aa4..2c7e12bb5d6f 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)