ref: 77eb7386648268ce697566f3f581b8e773d7ecae
parent: af2c50d3803f44521e4a6289a347f4823b2d8386
author: ment <thement@ibawizard.net>
date: Sun May 8 20:02:02 EDT 2011
disk/partfs: minor bugfixes
--- a/sys/src/cmd/disk/partfs.c
+++ b/sys/src/cmd/disk/partfs.c
@@ -49,7 +49,7 @@
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 @@
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;
--
⑨