From b98642a50b0cd11696eaad151638f8cf9d153c40 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Thu, 21 Jul 2016 00:58:08 +0200 Subject: [PATCH] block: avoid ubi{,block} duplicates Skip ubi?_? device if ubiblock?_? is present. Signed-off-by: Daniel Golle --- block.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/block.c b/block.c index 4d823e6..6c025fd 100644 --- a/block.c +++ b/block.c @@ -464,6 +464,16 @@ static int config_load(char *cfg) static struct blkid_struct_probe* _probe_path(char *path) { struct blkid_struct_probe *pr; + char tmppath[64]; + + /* skip ubi device if ubiblock device is present */ + if (path[5] == 'u' && path[6] == 'b' && path[7] == 'i' && + path[8] >= '0' && path[8] <= '9' ) { + snprintf(tmppath, sizeof(tmppath), "/dev/ubiblock%s", path + 8); + list_for_each_entry(pr, &devices, list) + if (!strcasecmp(pr->dev, tmppath)) + return NULL; + } pr = malloc(sizeof(*pr)); -- 2.25.1