Просмотр исходного кода

Set seekpos to 0 after reopening files in Seek()

If we just reopened the file, we also need to reset the current
seek position when we reset the buffer, otherwise the code will
not try to seek to the position given to Skip (from 0), but will
try to seek to old offset + the position given to skip.

Closes: #812994, #813000
Julian Andres Klode лет назад: 10
Родитель
Сommit
eda0c1ba43
1 измененных файлов с 1 добавлено и 0 удалено
  1. 1 0
      apt-pkg/contrib/fileutl.cc

+ 1 - 0
apt-pkg/contrib/fileutl.cc

@@ -1119,6 +1119,7 @@ public:
 	 return filefd->FileFdError("Seek on file %s because it couldn't be reopened", filefd->FileName.c_str());
 	 return filefd->FileFdError("Seek on file %s because it couldn't be reopened", filefd->FileName.c_str());
 
 
       buffer.reset();
       buffer.reset();
+      set_seekpos(0);
       if (To != 0)
       if (To != 0)
 	 return filefd->Skip(To);
 	 return filefd->Skip(To);