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 ad13b4badb
commit 2dfab56755

2
pmap.c
View File

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