summaryrefslogtreecommitdiff
path: root/bridges
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2011-12-15 11:57:08 +0100
committerStephan Bergmann <sbergman@redhat.com>2011-12-15 11:59:03 +0100
commitd11f2ccdcecca78bc654ca0b787ea112c1dfe10c (patch)
tree5d0b18fd7e501b91d07ca9eacd18c3278c72ad94 /bridges
parenta4312af08cbd8c69ba4bead9608f3bf549caf7a0 (diff)
Resolves: rhbz#767708 avoid SIGBUS writing to overcommitted mmaped diskspace
Diffstat (limited to 'bridges')
-rw-r--r--bridges/source/cpp_uno/shared/vtablefactory.cxx10
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 2703ac0c0fb6..b049c7f1d333 100644
--- a/bridges/source/cpp_uno/shared/vtablefactory.cxx
+++ b/bridges/source/cpp_uno/shared/vtablefactory.cxx
@@ -40,6 +40,7 @@
#include "osl/mutex.hxx"
#include "rtl/alloc.h"
#include "rtl/ustring.hxx"
+#include "sal/log.hxx"
#include "sal/types.h"
#include "typelib/typedescription.hxx"
@@ -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");
+ SAL_WARN("bridges", "posix_fallocate failed with code " << err);
close(block.fd);
block.fd = -1;
break;