summaryrefslogtreecommitdiffstats
path: root/debian/patches/upstream/tests-test_mkfds-sockdiag-verify-the-recived-message.patch
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-14 21:15:16 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-14 21:15:16 +0000
commit76d1ac955e8467cf5ddba500281248623a024b5a (patch)
tree5bb0db0ffa9da69915b5b95ba433352156293739 /debian/patches/upstream/tests-test_mkfds-sockdiag-verify-the-recived-message.patch
parentReleasing progress-linux version 2.40-1~progress7.99u1. (diff)
downloadutil-linux-76d1ac955e8467cf5ddba500281248623a024b5a.tar.xz
util-linux-76d1ac955e8467cf5ddba500281248623a024b5a.zip
Merging debian version 2.40-2.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/patches/upstream/tests-test_mkfds-sockdiag-verify-the-recived-message.patch')
-rw-r--r--debian/patches/upstream/tests-test_mkfds-sockdiag-verify-the-recived-message.patch56
1 files changed, 56 insertions, 0 deletions
diff --git a/debian/patches/upstream/tests-test_mkfds-sockdiag-verify-the-recived-message.patch b/debian/patches/upstream/tests-test_mkfds-sockdiag-verify-the-recived-message.patch
new file mode 100644
index 0000000..efd9063
--- /dev/null
+++ b/debian/patches/upstream/tests-test_mkfds-sockdiag-verify-the-recived-message.patch
@@ -0,0 +1,56 @@
+From: Masatake YAMATO <yamato@redhat.com>
+Date: Tue, 2 Apr 2024 06:34:40 +0900
+Subject: tests: (test_mkfds::sockdiag) verify the recived message
+
+Signed-off-by: Masatake YAMATO <yamato@redhat.com>
+---
+ tests/helpers/test_mkfds.c | 29 +++++++++++++++++++++++++++++
+ 1 file changed, 29 insertions(+)
+
+diff --git a/tests/helpers/test_mkfds.c b/tests/helpers/test_mkfds.c
+index 39427ba..4b138c2 100644
+--- a/tests/helpers/test_mkfds.c
++++ b/tests/helpers/test_mkfds.c
+@@ -3200,6 +3200,25 @@ static int send_diag_request(int diagsd, void *req, size_t req_size)
+ return 0;
+ }
+
++static int recv_diag_request(int diagsd)
++{
++ __attribute__((aligned(sizeof(void *)))) uint8_t buf[8192];
++ const struct nlmsghdr *h;
++ int r = recvfrom(diagsd, buf, sizeof(buf), 0, NULL, NULL);;
++ if (r < 0)
++ return errno;
++
++ h = (void *)buf;
++ if (!NLMSG_OK(h, (size_t)r))
++ return -1;
++
++ if (h->nlmsg_type == NLMSG_ERROR) {
++ struct nlmsgerr *e = (struct nlmsgerr *)NLMSG_DATA(h);
++ return - e->error;
++ }
++ return 0;
++}
++
+ static void *make_sockdiag(const struct factory *factory, struct fdesc fdescs[],
+ int argc, char ** argv)
+ {
+@@ -3243,6 +3262,16 @@ static void *make_sockdiag(const struct factory *factory, struct fdesc fdescs[],
+ err(EXIT_FAILURE, "failed in sendmsg()");
+ }
+
++ e = recv_diag_request(diagsd);
++ if (e != 0) {
++ close (diagsd);
++ if (e == ENOENT)
++ err(EXIT_ENOENT, "failed in recvfrom()");
++ if (e > 0)
++ err(EXIT_FAILURE, "failed in recvfrom()");
++ if (e < 0)
++ errx(EXIT_FAILURE, "failed in recvfrom() => -1");
++ }
+
+ if (diagsd != fdescs[0].fd) {
+ if (dup2(diagsd, fdescs[0].fd) < 0) {