Skip to content

Commit c2a28f5

Browse files
committed
Reverted my prev commit, because it generates errors
1 parent 1653303 commit c2a28f5

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

shmem.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -345,13 +345,14 @@ int shmdt (const void *shmaddr)
345345
DBG ("%s: munmap %p failed", __PRETTY_FUNCTION__, shmaddr);
346346
shmem[i].addr = NULL;
347347
DBG ("%s: unmapped addr %p for FD %d ID %d shmidx %x", __PRETTY_FUNCTION__, shmaddr, shmem[i].descriptor, i, shmem[i].remote);
348+
/*
348349
if (!shmem[i].descriptor)
349350
{
350351
DBG ("%s: Removing shmem entry for ID %d shmidx %x", __PRETTY_FUNCTION__, i, shmem[i].remote);
351352
shmem_amount --;
352353
memmove (&shmem[i], &shmem[i+1], (shmem_amount - i) * sizeof(shmem_t));
353354
}
354-
355+
*/
355356
pthread_mutex_unlock (&mutex);
356357
return 0;
357358
}
@@ -381,14 +382,13 @@ static int shm_remove (int shmid)
381382
if (shmem[idx].addr)
382383
{
383384
DBG ("%s: WARNING: shmid %x is still mapped to addr %p, call shmdt() first", __PRETTY_FUNCTION__, shmid, shmem[idx].addr);
385+
/*
384386
close (shmem[idx].descriptor);
385387
shmem[idx].descriptor = 0;
388+
*/
386389
pthread_mutex_unlock (&mutex);
387-
return 0;
388-
/*
389390
errno = EINVAL;
390391
return -1;
391-
*/
392392
}
393393
if (shmem[idx].descriptor)
394394
close (shmem[idx].descriptor);

0 commit comments

Comments
 (0)