diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2011-12-15 11:57:08 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2011-12-16 10:01:47 +0100 |
commit | 908e6a4b7417dfce1adb9fdaccf084ea7d4602ac (patch) | |
tree | 9bed04335658dbb66e401150b276114cbdc8a1d2 /bridges/source | |
parent | b469cd43117c6269db121207e1be5152907b4dd0 (diff) |
Resolves: rhbz#767708 avoid SIGBUS writing to overcommitted mmaped diskspace
(cherry picked from commit d11f2ccdcecca78bc654ca0b787ea112c1dfe10c)
Diffstat (limited to 'bridges/source')
-rw-r--r-- | 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 fd84a73ba675..801b16c60102 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; |