file: ignore host disk in blocklist check
It cannot work anyway because host disk cannot be read. This fixes hostfs access on native Windows build where filenames start with '\' or do not have initial separator at all (d:\foo). Issue was observed when running grub-fstest on Windows. On UNIX image name is canonicalized to always start with `/' so this was not noticed. This has side effect of allowing relative path names on host, but this already was the case with `ls' command, so it just extends it to all commands. Reported-By: Arch Stack <archstacker@gmail.com> Also-By: Arch Stack <archstacker@gmail.com>
This commit is contained in:
parent
c2443e49bc
commit
d31321835e
1 changed files with 5 additions and 1 deletions
|
@ -89,7 +89,11 @@ grub_file_open (const char *name)
|
||||||
|
|
||||||
file->device = device;
|
file->device = device;
|
||||||
|
|
||||||
if (device->disk && file_name[0] != '/')
|
if (device->disk && file_name[0] != '/'
|
||||||
|
#if defined(GRUB_UTIL) || defined(GRUB_MACHINE_EMU)
|
||||||
|
&& grub_strcmp (device->disk->name, "host")
|
||||||
|
#endif
|
||||||
|
)
|
||||||
/* This is a block list. */
|
/* This is a block list. */
|
||||||
file->fs = &grub_fs_blocklist;
|
file->fs = &grub_fs_blocklist;
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue