remove_plex: If we don't find the plex in a volume to which it

claims to belong, remove it anyway.
This commit is contained in:
Greg Lehey 1999-04-05 04:02:59 +00:00
parent 599fbeb550
commit 31e318aced

View File

@ -1708,8 +1708,12 @@ remove_plex_entry(int plexno, int force, int recurse)
for (myplexno = 0; myplexno < vol->plexes; myplexno++)
if (vol->plex[myplexno] == plexno) /* found it */
break;
if (myplexno == vol->plexes) /* didn't find it. Huh? */
throw_rude_remark(ENOENT, "volume %s does not contain plex %s", vol->name, plex->name);
if (myplexno == vol->plexes) { /* didn't find it. Huh? */
if (force)
log(LOG_ERR, "volume %s does not contain plex %s", vol->name, plex->name);
else
throw_rude_remark(ENOENT, "volume %s does not contain plex %s", vol->name, plex->name);
}
if (myplexno < (vol->plexes - 1)) /* not the last plex in the list */
bcopy(&vol->plex[myplexno + 1], &vol->plex[myplexno], vol->plexes - 1 - myplexno);
vol->plexes--;