Skip to content

Commit

Permalink
Handle sub-512-byte file size with special error message
Browse files Browse the repository at this point in the history
  • Loading branch information
ecashin committed May 22, 2014
1 parent 4fbf65b commit f449585
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions aoe.c
Expand Up @@ -519,10 +519,13 @@ main(int argc, char **argv)
size = getsize(bfd);
size /= 512;
if (size <= offset) {
fprintf(stderr,
"Offset %lld too large for %lld-sector export\n",
offset,
size);
if (offset)
fprintf(stderr,
"Offset %lld too large for %lld-sector export\n",
offset,
size);
else
fputs("0-sector file size is too small\n", stderr);
exit(1);
}
size -= offset;
Expand Down

0 comments on commit f449585

Please sign in to comment.