socket: Add a test for MSG_CMSG_CLOEXEC
commit904b94c07af84b7e4c98de3bbb822ccffcaf8c40
authorSergey Bugaev <bugaevc@gmail.com>
Sun, 23 Apr 2023 16:05:48 +0000 (23 19:05 +0300)
committerSamuel Thibault <samuel.thibault@ens-lyon.org>
Mon, 24 Apr 2023 22:21:00 +0000 (25 00:21 +0200)
tree26e2cba5aba3c1bd2d680289256af239026faec4
parent323fe6a1a9204e2126df63cb81a88831d1cdeaf5
socket: Add a test for MSG_CMSG_CLOEXEC

This checks that:
* We can send and receive fds over Unix domain sockets using SCM_RIGHTS;
* msg_controllen, cmsg_level, cmsg_type, cmsg_len are all filled in
  correctly on receive;
* Most importantly, the received fd has or has not the close-on-exec
  flag set depending on whether we pass MSG_CMSG_CLOEXEC to recvmsg ().

Checked on i686-gnu and x86_64-linux-gnu.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Message-Id: <20230423160548.126576-4-bugaevc@gmail.com>
socket/Makefile
socket/tst-cmsg_cloexec.c [new file with mode: 0644]