]> git.saurik.com Git - apt.git/commitdiff
Bill is consistent. Bill is correct. Be like Bill.
authorJay Freeman (saurik) <saurik@saurik.com>
Mon, 30 Jan 2017 17:43:43 +0000 (09:43 -0800)
committerJay Freeman (saurik) <saurik@saurik.com>
Mon, 30 Jan 2017 17:43:43 +0000 (09:43 -0800)
apt-pkg/contrib/mmap.cc

index f632cd6c54ecc622b385a63961f08700b71fe5e8..8fbddbd2f9823bfe838e6445efa0ac2086086aaf 100644 (file)
@@ -106,14 +106,14 @@ bool MMap::Map(FileFd &Fd)
            if (unlikely(Base == nullptr))
               return _error->Errno("MMap-malloc", _("Couldn't make mmap of %llu bytes"), iSize);
            SyncToFd = new FileFd();
-           return Fd.Read(Base, iSize);
+           return Fd.Seek(0L) && Fd.Read(Base, iSize);
         }
         // FIXME: Writing to compressed fd's ?
         int const dupped_fd = dup(Fd.Fd());
         if (dupped_fd == -1)
            return _error->Errno("mmap", _("Couldn't duplicate file descriptor %i"), Fd.Fd());
 
-        Base = calloc(iSize, 1);
+        Base = malloc(iSize);
         if (unlikely(Base == nullptr))
            return _error->Errno("MMap-calloc", _("Couldn't make mmap of %llu bytes"), iSize);
         SyncToFd = new FileFd (dupped_fd);