mirror of
https://git.code.sf.net/p/quake/nuq
synced 2024-11-29 07:11:45 +00:00
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:
parent
29635fb5d5
commit
0e3df0b239
1 changed files with 2 additions and 2 deletions
|
@ -146,8 +146,8 @@ qboolean SNDDMA_Init(void)
|
||||||
// memory map the dma buffer
|
// memory map the dma buffer
|
||||||
|
|
||||||
shm->buffer = (unsigned char *) mmap(NULL, info.fragstotal
|
shm->buffer = (unsigned char *) mmap(NULL, info.fragstotal
|
||||||
* info.fragsize, PROT_WRITE, MAP_FILE|MAP_SHARED, audio_fd, 0);
|
* info.fragsize, PROT_READ|PROT_WRITE, MAP_FILE|MAP_SHARED, audio_fd, 0);
|
||||||
if (!shm->buffer || shm->buffer == (unsigned char *)-1)
|
if (!shm->buffer || shm->buffer == MAP_FAILED)
|
||||||
{
|
{
|
||||||
perror("/dev/dsp");
|
perror("/dev/dsp");
|
||||||
Con_Printf("Could not mmap /dev/dsp\n");
|
Con_Printf("Could not mmap /dev/dsp\n");
|
||||||
|
|
Loading…
Reference in a new issue