diff options
author | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2020-09-29 14:45:09 -0300 |
---|---|---|
committer | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2020-10-02 16:11:59 -0300 |
commit | be9b0b9a012780a403a266c90878efffb9a5f3ca (patch) | |
tree | 35bbc1910849c6687267b06b24b84373e48a832d /sysvipc/test-sysvmsg.c | |
parent | 20a00dbefca5695cccaa44846a482db8ccdd85ab (diff) | |
download | glibc-be9b0b9a012780a403a266c90878efffb9a5f3ca.tar.gz glibc-be9b0b9a012780a403a266c90878efffb9a5f3ca.tar.xz glibc-be9b0b9a012780a403a266c90878efffb9a5f3ca.zip |
sysvipc: Return EINVAL for invalid msgctl 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-sysvmsg.c')
-rw-r--r-- | sysvipc/test-sysvmsg.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/sysvipc/test-sysvmsg.c b/sysvipc/test-sysvmsg.c index 84efdade5e..ada2881065 100644 --- a/sysvipc/test-sysvmsg.c +++ b/sysvipc/test-sysvmsg.c @@ -24,6 +24,8 @@ #include <sys/ipc.h> #include <sys/msg.h> +#include <test-sysvipc.h> + #include <support/support.h> #include <support/check.h> #include <support/temp_file.h> @@ -86,6 +88,9 @@ do_test (void) FAIL_EXIT1 ("msgget failed (errno=%d)", errno); } + TEST_COMPARE (msgctl (msqid, first_msg_invalid_cmd (), NULL), -1); + TEST_COMPARE (errno, EINVAL); + /* Get message queue kernel information and do some sanity checks. */ struct msqid_ds msginfo; if (msgctl (msqid, IPC_STAT, &msginfo) == -1) |