1 |
dmorgan |
184057 |
From d11f2ccdcecca78bc654ca0b787ea112c1dfe10c Mon Sep 17 00:00:00 2001 |
2 |
|
|
From: Stephan Bergmann <sbergman@redhat.com> |
3 |
|
|
Date: Thu, 15 Dec 2011 11:57:08 +0100 |
4 |
|
|
Subject: [PATCH] Resolves: rhbz#767708 avoid SIGBUS writing to overcommitted |
5 |
|
|
mmaped diskspace |
6 |
|
|
|
7 |
|
|
--- |
8 |
|
|
bridges/source/cpp_uno/shared/vtablefactory.cxx | 10 ++++++++-- |
9 |
|
|
1 files changed, 8 insertions(+), 2 deletions(-) |
10 |
|
|
|
11 |
|
|
diff --git a/bridges/source/cpp_uno/shared/vtablefactory.cxx b/bridges/source/cpp_uno/shared/vtablefactory.cxx |
12 |
|
|
index 2703ac0..b049c7f 100644 |
13 |
|
|
--- a/bridges/source/cpp_uno/shared/vtablefactory.cxx |
14 |
|
|
+++ b/bridges/source/cpp_uno/shared/vtablefactory.cxx |
15 |
|
|
@@ -65,6 +66,10 @@ |
16 |
|
|
#error Unsupported platform |
17 |
|
|
#endif |
18 |
|
|
|
19 |
|
|
+#if defined USE_DOUBLE_MMAP |
20 |
|
|
+#include <fcntl.h> |
21 |
|
|
+#endif |
22 |
|
|
+ |
23 |
|
|
using bridges::cpp_uno::shared::VtableFactory; |
24 |
|
|
|
25 |
|
|
namespace { |
26 |
|
|
@@ -259,9 +264,10 @@ bool VtableFactory::createBlock(Block &block, sal_Int32 slotCount) const |
27 |
|
|
} |
28 |
|
|
unlink(tmpfname); |
29 |
|
|
delete[] tmpfname; |
30 |
|
|
- if (ftruncate(block.fd, block.size) == -1) |
31 |
|
|
+ int err = posix_fallocate(block.fd, 0, block.size); |
32 |
|
|
+ if (err != 0) |
33 |
|
|
{ |
34 |
|
|
- perror("truncation of executable memory area failed"); |
35 |
|
|
+ fprintf(stderr, "posix_fallocate failed with code %d\n", err); |
36 |
|
|
close(block.fd); |
37 |
|
|
block.fd = -1; |
38 |
|
|
break; |
39 |
|
|
-- |
40 |
|
|
1.7.7.4 |
41 |
|
|
|