You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
libreoffice/0001-Resolves-rhbz-767708-a...

42 lines
1.3 KiB

From d11f2ccdcecca78bc654ca0b787ea112c1dfe10c Mon Sep 17 00:00:00 2001
From: Stephan Bergmann <sbergman@redhat.com>
Date: Thu, 15 Dec 2011 11:57:08 +0100
Subject: [PATCH] Resolves: rhbz#767708 avoid SIGBUS writing to overcommitted
mmaped diskspace
---
bridges/source/cpp_uno/shared/vtablefactory.cxx | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/bridges/source/cpp_uno/shared/vtablefactory.cxx b/bridges/source/cpp_uno/shared/vtablefactory.cxx
index 2703ac0..b049c7f 100644
--- a/bridges/source/cpp_uno/shared/vtablefactory.cxx
+++ b/bridges/source/cpp_uno/shared/vtablefactory.cxx
@@ -65,6 +66,10 @@
#error Unsupported platform
#endif
+#if defined USE_DOUBLE_MMAP
+#include <fcntl.h>
+#endif
+
using bridges::cpp_uno::shared::VtableFactory;
namespace {
@@ -259,9 +264,10 @@ bool VtableFactory::createBlock(Block &block, sal_Int32 slotCount) const
}
unlink(tmpfname);
delete[] tmpfname;
- if (ftruncate(block.fd, block.size) == -1)
+ int err = posix_fallocate(block.fd, 0, block.size);
+ if (err != 0)
{
- perror("truncation of executable memory area failed");
+ fprintf(stderr, "posix_fallocate failed with code %d\n", err);
close(block.fd);
block.fd = -1;
break;
--
1.7.7.4