summaryrefslogtreecommitdiffhomepage
path: root/x-plane-plugin
diff options
context:
space:
mode:
Diffstat (limited to 'x-plane-plugin')
-rw-r--r--x-plane-plugin/plugin.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/x-plane-plugin/plugin.c b/x-plane-plugin/plugin.c
index ed6cdaff..62c9d6f0 100644
--- a/x-plane-plugin/plugin.c
+++ b/x-plane-plugin/plugin.c
@@ -62,10 +62,8 @@ PortableLockedShm* PortableLockedShm_init(const char *shmName, const char *OT_UN
/* (void) shm_unlink(shm_filename); */
self->fd = shm_open(shm_filename, O_RDWR | O_CREAT, 0600);
- if (ftruncate(self->fd, mapSize) == 0)
- self->mem = mmap(NULL, mapSize, PROT_READ|PROT_WRITE, MAP_SHARED, self->fd, (off_t)0);
- else
- self->mem = (void*) -1;
+ (void) ftruncate(self->fd, mapSize);
+ self->mem = mmap(NULL, mapSize, PROT_READ|PROT_WRITE, MAP_SHARED, self->fd, (off_t)0);
return self;
}