Fix SDL2 driver arguments to mmap() and sem_open()

Linux & MacOS seem to tolerate the incorrect parameters but they are wrong as per the documentation.
On more pedantic systems such as FreeBSD these calls fails.
This commit is contained in:
Joel Bodenmann 2021-09-21 17:44:43 +02:00
parent 4261a1fb0b
commit 1c29a88ee1

View File

@ -174,8 +174,8 @@ static struct SDL_UGFXContext *context;
static sem_t *ctx_mutex;
static sem_t *input_event;
#define CTX_MUTEX_NAME "ugfx_ctx_mutex"
#define INPUT_EVENT_NAME "ugfx_input_event"
#define CTX_MUTEX_NAME "/ugfx_ctx_mutex"
#define INPUT_EVENT_NAME "/ugfx_input_event"
static int SDL_loop (void) {
@ -316,7 +316,7 @@ void sdl_driver_init (void) {
exit (1) ;
}
if ((context = (struct SDL_UGFXContext*) mmap (0,sizeof (struct SDL_UGFXContext ),PROT_WRITE|PROT_READ,(MAP_ANONYMOUS | MAP_SHARED),0,0)) ==MAP_FAILED) {
if ((context = (struct SDL_UGFXContext*) mmap (0, sizeof(struct SDL_UGFXContext), PROT_WRITE|PROT_READ, (MAP_ANONYMOUS | MAP_SHARED), -1, 0)) == MAP_FAILED) {
perror("Failed to allocate shared memory");
exit(1);
}