summaryrefslogtreecommitdiff
path: root/bridges
diff options
context:
space:
mode:
authorCaolán McNamara <cmc@openoffice.org>2009-10-12 13:29:25 +0000
committerCaolán McNamara <cmc@openoffice.org>2009-10-12 13:29:25 +0000
commitbf9defceee8cef7a167dae7eed7f9b5a9c50a609 (patch)
treeb50174ac66e3bb83a7f086a6da1d81a163373a5e /bridges
parente1a0ec139488cddf616bdb5756d925e6c842a604 (diff)
#i105828# clear -Wp,-D_FORTIFY_SOURCE=2 warnings
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 34e5f9635974..3784f3959594 100644
--- a/bridges/source/cpp_uno/shared/vtablefactory.cxx
+++ b/bridges/source/cpp_uno/shared/vtablefactory.cxx
@@ -272,7 +272,7 @@ bool VtableFactory::createBlock(Block &block, sal_Int32 slotCount) const
char *tmpfname = new char[aTmpName.getLength()+1];
strncpy(tmpfname, aTmpName.getStr(), aTmpName.getLength()+1);
if ((block.fd = mkstemp(tmpfname)) == -1)
- perror("creation of executable memory area failed");
+ perror("creation of executable memory area failed");
if (block.fd == -1)
{
delete[] tmpfname;
@@ -280,7 +280,13 @@ bool VtableFactory::createBlock(Block &block, sal_Int32 slotCount) const
}
unlink(tmpfname);
delete[] tmpfname;
- ftruncate(block.fd, block.size);
+ if (ftruncate(block.fd, block.size) == -1)
+ {
+ perror("truncation of executable memory area failed");
+ close(block.fd);
+ block.fd = -1;
+ break;
+ }
block.start = mmap(NULL, block.size, PROT_READ | PROT_WRITE, MAP_SHARED, block.fd, 0);
if (block.start== MAP_FAILED) {
block.start = 0;