From 3004416b35dea148212d4aa881ae099d20f3e313 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 30 Nov 2013 18:05:40 +0100 Subject: untested merge from compat, hopefully fix osx Signed-off-by: Stanislaw Halik --- x-plane-plugin/plugin.c | 6 ++---- 1 file 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; } -- cgit v1.2.3