]> git.ipfire.org Git - thirdparty/util-linux.git/commit
ipcs: fix shmctl() usage
authorKarel Zak <kzak@redhat.com>
Fri, 19 Dec 2014 12:42:41 +0000 (13:42 +0100)
committerKarel Zak <kzak@redhat.com>
Fri, 19 Dec 2014 12:42:41 +0000 (13:42 +0100)
commit929c257548049f34d357355fc72a6f1540f751cf
tree954a8a9338ce5b59fdf16923d2ecbc4dc8e49fff
parent7ef338f39de0d9661e5a0e234b89e46546b21e22
ipcs: fix shmctl() usage

The function shmctl() has to be called with 'struct shmid_ds', and if
you need 'struct shminfo' then the right way is to cast:

bad way:
  struct shm_info info;

  shmctl(0, SHM_INFO, &info);

right way:
  struct shmid_ds buf;
  struct shm_info *info;

  shmctl(0, SHM_INFO, &buf);
  info = (struct shm_info *) &buf);

The patch also fixes bug in ipc_shm_get_limits() where is missing
lim->shmmax in code based on shmctl().

Signed-off-by: Karel Zak <kzak@redhat.com>
sys-utils/ipcrm.c
sys-utils/ipcs.c
sys-utils/ipcutils.c