summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJay Freeman (saurik) <saurik@saurik.com>2017-01-30 09:43:43 -0800
committerSam Bingner <sam@bingner.com>2020-07-17 00:22:23 -1000
commitd41a295e0a9b88f9136b020a1f6a25324bae80c7 (patch)
treeed6dde2a9e0bbb6bbad2214a1cb0ffeb4336b83b
parentc3d6ccddcc7888fa6797ce330e680cdd3d42a42e (diff)
Bill is consistent. Bill is correct. Be like Bill.
-rw-r--r--apt-pkg/contrib/mmap.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/apt-pkg/contrib/mmap.cc b/apt-pkg/contrib/mmap.cc
index bb190fef0..0330e5700 100644
--- a/apt-pkg/contrib/mmap.cc
+++ b/apt-pkg/contrib/mmap.cc
@@ -104,14 +104,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);