mmap could fail, handle gracefully

This commit is contained in:
Ludwig Nussel 2010-01-04 16:02:01 +00:00
parent f19d437564
commit 4abf1aa398

View file

@ -106,6 +106,8 @@ int mumble_link(const char* name)
lm = (LinkedMem *) (mmap(NULL, sizeof(LinkedMem), PROT_READ | PROT_WRITE, MAP_SHARED, shmfd,0));
if (lm == (void *) (-1)) {
lm = NULL;
close(shmfd);
return -1;
}
close(shmfd);
#endif