Fix a bug in tftp_read, which may appear when seeking back.
This commit is contained in:
parent
3785f597a0
commit
902ee9ccaf
2 changed files with 21 additions and 8 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
2001-10-13 Yoshinori K. Okuji <okuji@gnu.org>
|
||||||
|
|
||||||
|
* netboot/fsys_tftp.c (tftp_read): Move the unused data
|
||||||
|
forwards, only if AMT is more than zero. If AMT is not positive,
|
||||||
|
subtract BUF_READ from SAVED_FILEPOS and set BUF_READ to zero,
|
||||||
|
to skip the whole buffer. Reported by Frank Mehnert.
|
||||||
|
|
||||||
2001-10-13 Yoshinori K. Okuji <okuji@gnu.org>
|
2001-10-13 Yoshinori K. Okuji <okuji@gnu.org>
|
||||||
|
|
||||||
Don't use get_diskinfo_floppy. Reported by Ben Liblit
|
Don't use get_diskinfo_floppy. Reported by Ben Liblit
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* GRUB -- GRand Unified Bootloader
|
* GRUB -- GRand Unified Bootloader
|
||||||
* Copyright (C) 2000 Free Software Foundation, Inc.
|
* Copyright (C) 2000, 2001 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -367,15 +367,21 @@ tftp_read (char *addr, int size)
|
||||||
addr += amt;
|
addr += amt;
|
||||||
filepos += amt;
|
filepos += amt;
|
||||||
ret += amt;
|
ret += amt;
|
||||||
}
|
|
||||||
|
|
||||||
/* If the size of the empty space becomes small, move the unused
|
/* If the size of the empty space becomes small, move the unused
|
||||||
data forwards. */
|
data forwards. */
|
||||||
if (filepos - saved_filepos > FSYS_BUFLEN / 2)
|
if (filepos - saved_filepos > FSYS_BUFLEN / 2)
|
||||||
|
{
|
||||||
|
grub_memmove (buf, buf + FSYS_BUFLEN / 2, FSYS_BUFLEN / 2);
|
||||||
|
buf_read -= FSYS_BUFLEN / 2;
|
||||||
|
saved_filepos += FSYS_BUFLEN / 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
grub_memmove (buf, buf + FSYS_BUFLEN / 2, FSYS_BUFLEN / 2);
|
/* Skip the whole buffer. */
|
||||||
buf_read -= FSYS_BUFLEN / 2;
|
saved_filepos += buf_read;
|
||||||
saved_filepos += FSYS_BUFLEN / 2;
|
buf_read = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read the data. */
|
/* Read the data. */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue