summaryrefslogtreecommitdiff
path: root/bridges/source/cpp_uno/shared/vtablefactory.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'bridges/source/cpp_uno/shared/vtablefactory.cxx')
-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;