mirror of
https://gitlab.com/sortix/sortix.git
synced 2023-02-13 20:55:38 -05:00
Fix mbr error messages on empty partitions.
This commit is contained in:
parent
cef4c8d982
commit
5c0c479347
1 changed files with 3 additions and 2 deletions
|
@ -237,9 +237,10 @@ int main(int argc, char* argv[])
|
|||
if ( fd < 0 )
|
||||
error(1, errno, "`%s'", path);
|
||||
struct mbr mbr;
|
||||
if ( preadall(fd, &mbr, sizeof(mbr), 0) != sizeof(mbr) )
|
||||
size_t amount = preadall(fd, &mbr, sizeof(mbr), 0);
|
||||
if ( amount < sizeof(mbr) && errno != EEOF )
|
||||
error(1, errno, "read: `%s'", path);
|
||||
if ( !verify_is_mbr(&mbr) )
|
||||
if ( amount < sizeof(mbr) || !verify_is_mbr(&mbr) )
|
||||
{
|
||||
if ( probe )
|
||||
exit(1);
|
||||
|
|
Loading…
Add table
Reference in a new issue