Rename detached plexes and subdisks correctly (off by one error)
Submitted by: Terry Glanfield <Terry.Glanfield@program-products.co.uk>
This commit is contained in:
parent
ed4963f8e1
commit
3daf911efe
@ -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';
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user