mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-28 16:43:09 +00:00
Return an error if the size of the sector is zero. This is for removable
devices that is not inserted any media. This is MFC candidate. Submitted by: ISAKA Yoji <isaka@cory.jp>
This commit is contained in:
parent
cd3edecb19
commit
7a6b06168b
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=108292
@ -166,6 +166,8 @@ Int_Open_Disk(const char *name)
|
||||
exit (0);
|
||||
}
|
||||
|
||||
if (s == 0)
|
||||
return (NULL);
|
||||
d->sector_size = s;
|
||||
len /= s; /* media size in number of sectors. */
|
||||
|
||||
@ -481,6 +483,8 @@ Set_Boot_Mgr(struct disk *d, const u_char *b, const size_t s)
|
||||
{
|
||||
#if !defined(__ia64__)
|
||||
#ifdef PC98
|
||||
if (d->sector_size == 0)
|
||||
return;
|
||||
if (bootipl_size % d->sector_size != 0)
|
||||
return;
|
||||
if (d->bootipl)
|
||||
@ -509,6 +513,8 @@ Set_Boot_Mgr(struct disk *d, const u_char *b, const size_t s)
|
||||
memcpy(d->bootmenu, bootmenu, bootmenu_size);
|
||||
}
|
||||
#else
|
||||
if (d->sector_size == 0)
|
||||
return;
|
||||
if (s % d->sector_size != 0)
|
||||
return;
|
||||
if (d->bootmgr)
|
||||
|
Loading…
Reference in New Issue
Block a user