pmap: Do not display error if shmctl(..IPC_RMID) returns EINVAL

The segment may have been destroyed by the kernel automagically
after shmdt(addr)

How to reproduce:

sysctl -w kernel.shm_rmid_forced=1
./pmap 1
shared memory remove: Invalid argument
[..]
This commit is contained in:
Cristian Rodríguez 2016-04-28 02:22:53 -03:00 committed by Craig Small
parent 99d71ad581
commit 7bf9457f71

2
pmap.c
View File

@ -201,7 +201,7 @@ static void discover_shm_minor(void)
perror(_("shared memory detach")); perror(_("shared memory detach"));
out_destroy: out_destroy:
if (shmctl(shmid, IPC_RMID, NULL)) if (shmctl(shmid, IPC_RMID, NULL) && errno != EINVAL)
perror(_("shared memory remove")); perror(_("shared memory remove"));
return; return;