summaryrefslogtreecommitdiff
path: root/bridges
diff options
context:
space:
mode:
Diffstat (limited to 'bridges')
-rw-r--r--bridges/source/cpp_uno/shared/makefile.mk4
-rw-r--r--bridges/source/cpp_uno/shared/vtablefactory.cxx8
2 files changed, 12 insertions, 0 deletions
diff --git a/bridges/source/cpp_uno/shared/makefile.mk b/bridges/source/cpp_uno/shared/makefile.mk
index 4ce8122f3261..c71ba6b614e8 100644
--- a/bridges/source/cpp_uno/shared/makefile.mk
+++ b/bridges/source/cpp_uno/shared/makefile.mk
@@ -33,6 +33,10 @@ ENABLE_EXCEPTIONS = TRUE
.INCLUDE: settings.mk
+.IF "$(HAVE_POSIX_FALLOCATE)" == "YES"
+CDEFS += -DHAVE_POSIX_FALLOCATE
+.ENDIF
+
SLOFILES = \
$(SLO)$/bridge.obj \
$(SLO)$/component.obj \
diff --git a/bridges/source/cpp_uno/shared/vtablefactory.cxx b/bridges/source/cpp_uno/shared/vtablefactory.cxx
index b049c7f1d333..830d899ea91a 100644
--- a/bridges/source/cpp_uno/shared/vtablefactory.cxx
+++ b/bridges/source/cpp_uno/shared/vtablefactory.cxx
@@ -264,10 +264,18 @@ bool VtableFactory::createBlock(Block &block, sal_Int32 slotCount) const
}
unlink(tmpfname);
delete[] tmpfname;
+#if defined(HAVE_POSIX_FALLOCATE)
int err = posix_fallocate(block.fd, 0, block.size);
+#else
+ int err = ftruncate(block.fd, block.size);
+#endif
if (err != 0)
{
+#if defined(HAVE_POSIX_FALLOCATE)
SAL_WARN("bridges", "posix_fallocate failed with code " << err);
+#else
+ SAL_WARN("bridges", "truncation of executable memory area failed with code " << err);
+#endif
close(block.fd);
block.fd = -1;
break;