aboutsummaryrefslogtreecommitdiffstats
path: root/libs
diff options
context:
space:
mode:
authorLloyd Parkes <lloyd@must-have-coffee.gen.nz>2022-10-16 12:36:00 +1300
committerLloyd Parkes <lloyd@must-have-coffee.gen.nz>2022-10-16 12:36:00 +1300
commit635aa2a3fcfb4e9c6a9beba3fd5d818631c75c3f (patch)
tree1131133e513e57981db9a0b11ee6d7dcb2fe2f23 /libs
parentfcf742837e2356872f6ca88382a24911cccfff53 (diff)
downloadyosys-635aa2a3fcfb4e9c6a9beba3fd5d818631c75c3f.tar.gz
yosys-635aa2a3fcfb4e9c6a9beba3fd5d818631c75c3f.tar.bz2
yosys-635aa2a3fcfb4e9c6a9beba3fd5d818631c75c3f.zip
Forcibly set the current seek location of gz files that we are accessing
via dup(fileno());gzdopen() because stdio might have buffered data from the underlying file meaning that the underlying seek position isn't what we think it is.
Diffstat (limited to 'libs')
-rw-r--r--libs/fst/fstapi.cc1
1 files changed, 1 insertions, 0 deletions
diff --git a/libs/fst/fstapi.cc b/libs/fst/fstapi.cc
index b79470db3..f1b726518 100644
--- a/libs/fst/fstapi.cc
+++ b/libs/fst/fstapi.cc
@@ -4272,6 +4272,7 @@ int fstReaderInit(struct fstReaderContext *xc)
#endif
zfd = dup(fileno(xc->f));
+ lseek(zfd, ftell(xc->f), SEEK_SET);
zhandle = gzdopen(zfd, "rb");
if (zhandle) {
for (offpnt = 0; offpnt < uclen; offpnt += FST_GZIO_LEN) {