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
This commit is contained in:
Jeff Teunissen 2000-09-21 06:27:08 +00:00
parent ddef594b2e
commit acace1d0eb

View file

@ -150,8 +150,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 == MAP_FAILED) {
* 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");
close(audio_fd);