summaryrefslogtreecommitdiffstats
path: root/debian/patches/upstream/0005-lsblk-fix-endless-loop-if-device-specified-more-than.patch
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 14:30:36 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 14:30:36 +0000
commitd731b1222e17e0081e5e4e1fc9603b67ba0b72e3 (patch)
treee0426bca9e6173cf00b0ee2573aa2c0cf96b8a25 /debian/patches/upstream/0005-lsblk-fix-endless-loop-if-device-specified-more-than.patch
parentAdding upstream version 2.38.1. (diff)
downloadutil-linux-debian/2.38.1-5.tar.xz
util-linux-debian/2.38.1-5.zip
Adding debian version 2.38.1-5.debian/2.38.1-5debian
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--debian/patches/upstream/0005-lsblk-fix-endless-loop-if-device-specified-more-than.patch41
1 files changed, 41 insertions, 0 deletions
diff --git a/debian/patches/upstream/0005-lsblk-fix-endless-loop-if-device-specified-more-than.patch b/debian/patches/upstream/0005-lsblk-fix-endless-loop-if-device-specified-more-than.patch
new file mode 100644
index 0000000..8d3c8f7
--- /dev/null
+++ b/debian/patches/upstream/0005-lsblk-fix-endless-loop-if-device-specified-more-than.patch
@@ -0,0 +1,41 @@
+From: Karel Zak <kzak@redhat.com>
+Date: Mon, 19 Sep 2022 14:23:25 +0200
+Subject: [PATCH 05/24] lsblk: fix endless loop if device specified more than
+ once
+
+Fixes: https://github.com/util-linux/util-linux/issues/1814
+Signed-off-by: Karel Zak <kzak@redhat.com>
+---
+ misc-utils/lsblk-devtree.c | 17 +++++++++++++++++
+ 1 file changed, 17 insertions(+)
+
+diff --git a/misc-utils/lsblk-devtree.c b/misc-utils/lsblk-devtree.c
+index ce9d3e8..6f9dc54 100644
+--- a/misc-utils/lsblk-devtree.c
++++ b/misc-utils/lsblk-devtree.c
+@@ -282,8 +282,25 @@ void lsblk_unref_devtree(struct lsblk_devtree *tr)
+ }
+ }
+
++static int has_root(struct lsblk_devtree *tr, struct lsblk_device *dev)
++{
++ struct lsblk_iter itr;
++ struct lsblk_device *x = NULL;
++
++ lsblk_reset_iter(&itr, LSBLK_ITER_FORWARD);
++
++ while (lsblk_devtree_next_root(tr, &itr, &x) == 0) {
++ if (x == dev)
++ return 1;
++ }
++ return 0;
++}
++
+ int lsblk_devtree_add_root(struct lsblk_devtree *tr, struct lsblk_device *dev)
+ {
++ if (has_root(tr, dev))
++ return 0;
++
+ if (!lsblk_devtree_has_device(tr, dev))
+ lsblk_devtree_add_device(tr, dev);
+