diff options
author | Karel Zak | 2014-12-19 13:42:41 +0100 |
---|---|---|
committer | Karel Zak | 2014-12-19 13:42:41 +0100 |
commit | 929c257548049f34d357355fc72a6f1540f751cf (patch) | |
tree | 954a8a9338ce5b59fdf16923d2ecbc4dc8e49fff /sys-utils/ipcrm.c | |
parent | tests: don't check the current ipcs limits (diff) | |
download | kernel-qcow2-util-linux-929c257548049f34d357355fc72a6f1540f751cf.tar.gz kernel-qcow2-util-linux-929c257548049f34d357355fc72a6f1540f751cf.tar.xz kernel-qcow2-util-linux-929c257548049f34d357355fc72a6f1540f751cf.zip |
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>
Diffstat (limited to 'sys-utils/ipcrm.c')
-rw-r--r-- | sys-utils/ipcrm.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/sys-utils/ipcrm.c b/sys-utils/ipcrm.c index 6443f48fb..5fe3df849 100644 --- a/sys-utils/ipcrm.c +++ b/sys-utils/ipcrm.c @@ -235,7 +235,6 @@ static int remove_all(type_id type) int id, rm_me, maxid; struct shmid_ds shmseg; - struct shm_info shm_info; struct semid_ds semary; struct seminfo seminfo; @@ -245,8 +244,7 @@ static int remove_all(type_id type) struct msginfo msginfo; if (type == SHM || type == ALL) { - maxid = - shmctl(0, SHM_INFO, (struct shmid_ds *)(void *)&shm_info); + maxid = shmctl(0, SHM_INFO, &shmseg); if (maxid < 0) errx(EXIT_FAILURE, _("kernel not configured for shared memory")); |