Correctly skip the '/dev/' part when creating new drives and prefix

a drive's provider with '/dev/' when printing the config.

Reported by:  will@
This commit is contained in:
Lukas Ertl 2004-10-02 20:12:20 +00:00
parent 79e295e875
commit d9d3a74c87
2 changed files with 8 additions and 5 deletions

View File

@ -402,10 +402,13 @@ gv_new_drive(int max, char *token[])
errors++;
break;
}
ptr = token[j] + strlen(token[j]);
while (ptr != token[j] && *ptr != '/')
ptr--;
ptr++;
ptr = token[j];
if (*ptr == '/') {
ptr++;
while (*ptr != '/')
ptr++;
ptr++;
}
strncpy(d->device, ptr, GV_MAXDRIVENAME);
} else {
/* We assume this is the drive name. */

View File

@ -189,7 +189,7 @@ gv_format_config(struct gv_softc *sc, struct sbuf *sb, int ondisk, char *prefix)
*/
if (!ondisk) {
LIST_FOREACH(d, &sc->drives, drive) {
sbuf_printf(sb, "%sdrive %s device %s\n", prefix,
sbuf_printf(sb, "%sdrive %s device /dev/%s\n", prefix,
d->name, d->device);
}
}