fix some bugs in biosdisk.
This commit is contained in:
parent
f2151e4b57
commit
82889257ad
2 changed files with 22 additions and 6 deletions
|
@ -1,3 +1,11 @@
|
|||
1999-09-10 OKUJI Yoshinori <okuji@kuicr.kyoto-u.ac.jp>
|
||||
|
||||
* grub/asmstub.c (_FILE_OFFSET_BITS): Defined.
|
||||
(biosdisk) [!__linux__]: Pass the offset argument as off_t
|
||||
instead of int to lseek, and compare the return value with
|
||||
OFFSET. Reported by Pavel Roskin.
|
||||
(grub_stage2) [!__linux__ && !__GNU__]: Print a warning message.
|
||||
|
||||
1999-09-08 OKUJI Yoshinori <okuji@kuicr.kyoto-u.ac.jp>
|
||||
|
||||
* stage2/stage2.c (run_menu): If run_script is successfully
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
|
||||
/* Try to use glibc's transparant LFS support. */
|
||||
#define _LARGEFILE_SOURCE 1
|
||||
/* lseek becomes synonymous with lseek64. */
|
||||
#define _FILE_OFFSET_BITS 64
|
||||
|
||||
/* Simulator entry point. */
|
||||
int grub_stage2 (void);
|
||||
|
@ -154,8 +156,10 @@ grub_stage2 (void)
|
|||
char buf[512];
|
||||
#ifdef __linux__
|
||||
char unit = 'a' + i;
|
||||
#else
|
||||
#elif defined(__GNU__)
|
||||
char unit = '0' + i;
|
||||
#else
|
||||
#warning "BIOS drives cannot be guessed in your operating system."
|
||||
#endif
|
||||
|
||||
sprintf (name, "/dev/hd%c", unit);
|
||||
|
@ -204,7 +208,7 @@ grub_stage2 (void)
|
|||
assert (name);
|
||||
#ifdef __linux__
|
||||
sprintf (name, "/dev/sd%c", i + 'a');
|
||||
#else
|
||||
#elif defined(__GNU__)
|
||||
sprintf (name, "/dev/sd%d", i);
|
||||
#endif
|
||||
device_map[num_hd++ + 0x80] = name;
|
||||
|
@ -755,9 +759,13 @@ biosdisk (int subfunc, int drive, struct geometry *geometry,
|
|||
return -1;
|
||||
}
|
||||
#else
|
||||
if (lseek (fd, sector * SECTOR_SIZE, SEEK_SET))
|
||||
{
|
||||
off_t offset = (off_t) sector * (off_t) SECTOR_SIZE;
|
||||
|
||||
if (lseek (fd, offset, SEEK_SET) != offset)
|
||||
return -1;
|
||||
#endif /* __linux__ */
|
||||
}
|
||||
#endif
|
||||
|
||||
buf = (char *) (segment << 4);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue