mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-19 10:53:58 +00:00
719077d1be
kernels. The error message was "elf_loadexec: cannot seek". Libstand maintains a read-ahead buffer for each open file, so that it can read in chunks of 512 bytes for greater efficiency. When the loader tries to lseek forward in a file by a small amount, it sometimes happens that the target file offset is already in the read-ahead buffer. But the lseek code simply discarded the contents of that buffer and performed a seek directly on the underlying file. This resulted in an attempt to seek backwards in the file, since some of the data has already been read into the read-ahead buffer. Gzipped data streams cannot seek backwards, so an error was returned. This commit adds code which checks to see if the desired file offset is already in the read-ahead buffer. If it is, the code simply adjusts the buffer pointer and length, thereby avoiding a reverse seek on the gzipped data stream. I incorporated a suggestion from Matt Dillon which saved a little bit of code in this fix. Reviewed by: dillon, gallatin, jhb |
||
---|---|---|
.. | ||
alpha | ||
i386 | ||
ia64 | ||
powerpc | ||
__main.c | ||
arp.c | ||
assert.c | ||
bcd.c | ||
bootp.c | ||
bootp.h | ||
bootparam.c | ||
bootparam.h | ||
bswap.c | ||
cd9660.c | ||
close.c | ||
closeall.c | ||
dev_net.c | ||
dev_net.h | ||
dev.c | ||
dosfs.c | ||
dosfs.h | ||
environment.c | ||
ether.c | ||
ext2fs.c | ||
fstat.c | ||
getopt.c | ||
gets.c | ||
globals.c | ||
gzipfs.c | ||
if_ether.h | ||
in_cksum.c | ||
inet_ntoa.c | ||
ioctl.c | ||
iodesc.h | ||
libstand.3 | ||
lseek.c | ||
Makefile | ||
net.c | ||
net.h | ||
netif.c | ||
netif.h | ||
nfs.c | ||
nfsv2.h | ||
nullfs.c | ||
open.c | ||
pager.c | ||
printf.c | ||
qdivrem.c | ||
quad.h | ||
random.c | ||
rarp.c | ||
read.c | ||
readdir.c | ||
rpc.c | ||
rpc.h | ||
rpcv2.h | ||
saioctl.h | ||
sbrk.c | ||
stand.h | ||
stat.c | ||
strcasecmp.c | ||
strdup.c | ||
strerror.c | ||
strtol.c | ||
tftp.c | ||
tftp.h | ||
twiddle.c | ||
udp.c | ||
ufs.c | ||
write.c | ||
zalloc_defs.h | ||
zalloc_malloc.c | ||
zalloc_mem.h | ||
zalloc_protos.h | ||
zalloc.c | ||
zipfs.c |