diff options
author | Robert Nagy <robert.nagy@gmail.com> | 2011-12-21 16:16:22 +0100 |
---|---|---|
committer | Robert Nagy <robert.nagy@gmail.com> | 2011-12-21 16:17:45 +0100 |
commit | b8b22391ae7f87c8fb495a9e6839ed508fdaf932 (patch) | |
tree | 9d8b35f7d1b260c64c1cc3afb13420140488d18b /bridges | |
parent | 56c0d3b569ba62eafe94f79299e5afb83f2f891b (diff) |
only use posix_fallocate() if it's actually available
Diffstat (limited to 'bridges')
-rw-r--r-- | bridges/source/cpp_uno/shared/makefile.mk | 4 | ||||
-rw-r--r-- | bridges/source/cpp_uno/shared/vtablefactory.cxx | 8 |
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; |