Projects
Factory:RISC-V:Base
util-linux
_service:tar_scm:backport-lsblk-fix-endless-loo...
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:tar_scm:backport-lsblk-fix-endless-loop-if-device-specified-more-than-once.patch of Package util-linux
From 9eb31ca7f7971101846bd3668be5d7807200fa2f Mon Sep 17 00:00:00 2001 From: Karel Zak <kzak@redhat.com> Date: Mon, 19 Sep 2022 14:23:25 +0200 Subject: [PATCH] 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 ce9d3e84f7..6f9dc54b3c 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);
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2