Commit ad5e8d9e authored by Mike Hibler's avatar Mike Hibler
Browse files

If there are no valid data to save, exit with an error.

E.g., telling it to save an unused (type 0) partition. Previously, we
would create a single valid range with start at the beginning of disk
(or partition) and a size of zero. However, size zero is taken by the
imagezip compressor to mean "til EOF" so we would wind up creating a
really large image instead of doing nothing.

It is debatable whether this is really an error. Perhaps we should just
create a valid image file with one chunk containing no valid ranges, but
it seems likely that they probably made a mistake and we should call it
out immediately.
parent 59dd9042
......@@ -783,6 +783,20 @@ main(int argc, char *argv[])
makeranges();
if (debug)
dumpranges(debug > 1);
if (ranges == NULL) {
/*
* No valid ranges, exit with an error.
*
* XXX it is debatable whether this is really an error.
* Perhaps we should just create a valid image file with
* one chunk containing no valid ranges, but it seems likely
* that they probably made a mistake and we should call it
* out immediately.
*/
fprintf(stderr,
"*** No valid data on specified disk/partition!?\n");
exit(1);
}
sortrange(&fixups, 0, cmpfixups);
if (debug > 1)
dumpfixups(debug > 2, 0);
......@@ -1551,7 +1565,8 @@ makeranges(void)
pskip = skips;
while (pskip) {
addvalid(offset, pskip->start - offset);
if ((pskip->start - offset) > 0)
addvalid(offset, pskip->start - offset);
offset = pskip->start + pskip->size;
ptmp = pskip;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment