From 0e3df0b2397a57ebd6282bdb951c3416ebb54203 Mon Sep 17 00:00:00 2001 From: Jeff Teunissen Date: Thu, 21 Sep 2000 06:28:15 +0000 Subject: [PATCH] mmap should set PROT_READ|PROT_WRITE, not just PROT_WRITE. Takes care of a problem with FreeBSD. Also, check for MAP_FAILED instead of (unsigned char *)-1 --- source/snd_oss.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/snd_oss.c b/source/snd_oss.c index 9c3f349..ab16935 100644 --- a/source/snd_oss.c +++ b/source/snd_oss.c @@ -146,8 +146,8 @@ qboolean SNDDMA_Init(void) // memory map the dma buffer shm->buffer = (unsigned char *) mmap(NULL, info.fragstotal - * info.fragsize, PROT_WRITE, MAP_FILE|MAP_SHARED, audio_fd, 0); - if (!shm->buffer || shm->buffer == (unsigned char *)-1) + * info.fragsize, PROT_READ|PROT_WRITE, MAP_FILE|MAP_SHARED, audio_fd, 0); + if (!shm->buffer || shm->buffer == MAP_FAILED) { perror("/dev/dsp"); Con_Printf("Could not mmap /dev/dsp\n");