]> git.saurik.com Git - apt.git/commitdiff
Set seekpos to 0 after reopening files in Seek()
authorJulian Andres Klode <jak@debian.org>
Wed, 10 Feb 2016 11:45:47 +0000 (12:45 +0100)
committerJulian Andres Klode <jak@debian.org>
Wed, 10 Feb 2016 11:48:37 +0000 (12:48 +0100)
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
apt-pkg/contrib/fileutl.cc

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