diff options
author | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2020-09-29 14:55:02 -0300 |
---|---|---|
committer | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2020-10-14 11:49:55 -0300 |
commit | 9ebaabeaac1a96b0d91f52902ce1dbf4f5a562dd (patch) | |
tree | d529303fc362a1fab5dc01dc06ff43975f14b4e5 /sysvipc/test-sysvshm.c | |
parent | a49d7fd4f764e97ccaf922e433046590ae52fce9 (diff) | |
download | glibc-9ebaabeaac1a96b0d91f52902ce1dbf4f5a562dd.tar glibc-9ebaabeaac1a96b0d91f52902ce1dbf4f5a562dd.tar.gz glibc-9ebaabeaac1a96b0d91f52902ce1dbf4f5a562dd.tar.bz2 glibc-9ebaabeaac1a96b0d91f52902ce1dbf4f5a562dd.zip |
sysvipc: Return EINVAL for invalid shmctl commands
It avoids regressions on possible future commands that might require
additional libc support. The downside is new commands added by newer
kernels will need further glibc support.
Checked on x86_64-linux-gnu and i686-linux-gnu (Linux v4.15 and v5.4).
Diffstat (limited to 'sysvipc/test-sysvshm.c')
-rw-r--r-- | sysvipc/test-sysvshm.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/sysvipc/test-sysvshm.c b/sysvipc/test-sysvshm.c index f083fd280b..a1b8b4823e 100644 --- a/sysvipc/test-sysvshm.c +++ b/sysvipc/test-sysvshm.c @@ -25,6 +25,8 @@ #include <sys/ipc.h> #include <sys/shm.h> +#include <test-sysvipc.h> + #include <support/support.h> #include <support/check.h> #include <support/temp_file.h> @@ -81,6 +83,9 @@ do_test (void) FAIL_EXIT1 ("shmget failed (errno=%d)", errno); } + TEST_COMPARE (shmctl (shmid, first_shm_invalid_cmd (), NULL), -1); + TEST_COMPARE (errno, EINVAL); + /* Get shared memory kernel information and do some sanity checks. */ struct shmid_ds shminfo; if (shmctl (shmid, IPC_STAT, &shminfo) == -1) |