Commit 6f4d886d authored by Mike Hibler's avatar Mike Hibler
Browse files

Don't seek on file unless we have something to read.

Gratuitous seeks are bad for TFTP.
parent 3cbaf8ff
......@@ -124,12 +124,13 @@ grub_elfXX_load (grub_elf_t elf, const char *filename,
(unsigned long long) load_addr,
(unsigned long long) phdr->p_memsz);
if (grub_file_seek (elf->file, phdr->p_offset) == (grub_off_t) -1)
return grub_errno;
if (phdr->p_filesz)
{
grub_ssize_t read;
if (grub_file_seek (elf->file, phdr->p_offset) == (grub_off_t) -1)
return grub_errno;
read = grub_file_read (elf->file, (void *) load_addr, phdr->p_filesz);
if (read != (grub_ssize_t) phdr->p_filesz)
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment