summaryrefslogtreecommitdiffstats
path: root/sys/dev/vinum
diff options
context:
space:
mode:
authorgrog <grog@FreeBSD.org>2000-12-20 05:16:46 +0000
committergrog <grog@FreeBSD.org>2000-12-20 05:16:46 +0000
commit36a1771965de70fb49f02ee50d4cb74e8a419989 (patch)
treebe447987bd8a4f697d5f6996d4d9dad7b9716a5f /sys/dev/vinum
parent8b50fee5545b987cc80a56e45ad57112b3a9a547 (diff)
downloadFreeBSD-src-36a1771965de70fb49f02ee50d4cb74e8a419989.zip
FreeBSD-src-36a1771965de70fb49f02ee50d4cb74e8a419989.tar.gz
Rename detached plexes and subdisks correctly (off by one error)
Submitted by: Terry Glanfield <Terry.Glanfield@program-products.co.uk>
Diffstat (limited to 'sys/dev/vinum')
-rw-r--r--sys/dev/vinum/vinumioctl.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/sys/dev/vinum/vinumioctl.c b/sys/dev/vinum/vinumioctl.c
index 309448a..8780e1c 100644
--- a/sys/dev/vinum/vinumioctl.c
+++ b/sys/dev/vinum/vinumioctl.c
@@ -688,10 +688,12 @@ detachobject(struct vinum_ioctl_msg *msg)
(plex->subdisks - 1 - sdno) * sizeof(int));
}
plex->subdisks--;
- if (!bcmp(plex->name, sd->name, strlen(plex->name))) { /* this subdisk is named after the plex */
+ if (!bcmp(plex->name, sd->name, strlen(plex->name) + 1))
+ /* this subdisk is named after the plex */
+ {
bcopy(sd->name,
&sd->name[3],
- min(strlen(sd->name), MAXSDNAME - 3));
+ min(strlen(sd->name) + 1, MAXSDNAME - 3));
bcopy("ex-", sd->name, 3);
sd->name[MAXSDNAME - 1] = '\0';
}
@@ -735,7 +737,9 @@ detachobject(struct vinum_ioctl_msg *msg)
(vol->plexes - 1 - plexno) * sizeof(int));
vol->plexes--;
vol->last_plex_read = 0; /* don't go beyond the end */
- if (!bcmp(vol->name, plex->name, strlen(vol->name))) { /* this plex is named after the volume */
+ if (!bcmp(vol->name, plex->name, strlen(vol->name) + 1))
+ /* this plex is named after the volume */
+ {
/* First, check if the subdisks are the same */
if (msg->recurse) {
int sdno;
@@ -743,14 +747,20 @@ detachobject(struct vinum_ioctl_msg *msg)
for (sdno = 0; sdno < plex->subdisks; sdno++) {
struct sd *sd = &SD[plex->sdnos[sdno]];
- if (!bcmp(plex->name, sd->name, strlen(plex->name))) { /* subdisk is named after the plex */
- bcopy(sd->name, &sd->name[3], min(strlen(sd->name), MAXSDNAME - 3));
+ if (!bcmp(plex->name, sd->name, strlen(plex->name) + 1))
+ /* subdisk is named after the plex */
+ {
+ bcopy(sd->name,
+ &sd->name[3],
+ min(strlen(sd->name) + 1, MAXSDNAME - 3));
bcopy("ex-", sd->name, 3);
sd->name[MAXSDNAME - 1] = '\0';
}
}
}
- bcopy(plex->name, &plex->name[3], min(strlen(plex->name), MAXPLEXNAME - 3));
+ bcopy(plex->name,
+ &plex->name[3],
+ min(strlen(plex->name) + 1, MAXPLEXNAME - 3));
bcopy("ex-", plex->name, 3);
plex->name[MAXPLEXNAME - 1] = '\0';
}
OpenPOWER on IntegriCloud