disk/partfs: minor bugfixes

This commit is contained in:
ment 2011-05-09 00:02:02 +02:00
parent 52c77e17ca
commit dca7c99602

View file

@ -49,7 +49,7 @@ ctlstring(void)
for (p = tab; p < tab + nelem(tab); p++)
if (p->inuse)
fmtprint(&fmt, "part %s %lld %lld\n",
p->name, p->offset, p->length);
p->name, p->offset, p->offset + p->length);
return fmtstrflush(&fmt);
}
@ -67,11 +67,14 @@ addpart(char *name, vlong start, vlong end)
werrstr("partition name already in use");
return -1;
}
for (p = tab; p < tab + nelem(tab) && p->inuse; p++)
if (strcmp(p->name, name) == 0) {
for (p = tab; p < tab + nelem(tab); p++)
if (p->inuse && strcmp(p->name, name) == 0) {
werrstr("partition name already in use");
return -1;
}
for (p = tab; p < tab + nelem(tab); p++)
if (!p->inuse)
break;
if(p == tab + nelem(tab)){
werrstr("no free partition slots");
return -1;