1
0
forked from pool/util-linux
util-linux/skip-lsfd-tests-PR2888.patch
Jan Engelhardt 796cf6f6e1 Accepting request 1164989 from home:kukuk:cleanup
- Update to release 2.40
  * Add lastlog2
  * agetty: Load autologin user from agetty.autologin credential
  * agetty: use get_terminal_default_type()
  * agetty: use sd_get_sessions() for number of users (#2088)
  * blockdev: add support for BLKGETZONESZ
  * cfdisk: ask y/n before wipe
  * cfdisk: properly handle out-of-order partitions during resize
  * chcpu: document limitations of -g
  * chsh: use libeconf to read /etc/shells
  * column: fix -l
  * column: fix memory leak
  * dmesg: fix FD leak
  * dmesg: fix delta calculation
  * dmesg: fix wrong size calculation
  * dmesg: support reading kmsg format from file
  * enosys: a new small command to make syscalls fail with ENOSYS
  * exch: new command to atomically exchanges paths between two files
  * fdisk: add support for partition resizing
  * fdisk: remove usage of VLA
  * fincore: add --output-all
  * findmnt: add --list-columns
  * findmnt: add -I, --dfi options for imitating the output of df -i
  * findmnt: add inode-related columns for implementing "df -i" like output
  * hexdump: add '--one-byte-hex' format option
  * hwclock: add support for RTC_VL_READ/RTC_VL_CLR ioctls
  * login: initialize noauth from login.noauth credential
  * lsblk: add --filter
  * lsblk: add --highlight
  * lsblk: add --list-columns

OBS-URL: https://build.opensuse.org/request/show/1164989
OBS-URL: https://build.opensuse.org/package/show/Base:System/util-linux?expand=0&rev=552
2024-04-04 22:34:28 +00:00

61 lines
1.7 KiB
Diff

From f98a4c12b366ae2b5e01fa30d72eef34f3bab681 Mon Sep 17 00:00:00 2001
From: Masatake YAMATO <yamato@redhat.com>
Date: Tue, 2 Apr 2024 06:34:40 +0900
Subject: [PATCH 2/2] tests: (test_mkfds::sockdiag) verify the recieved message
to detect whether the socket is usable or not
Close #2822.
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 39427ba09a..4b138c2efd 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) {