summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Golle <daniel@makrotopia.org>2021-07-28 17:30:31 +0100
committerDaniel Golle <daniel@makrotopia.org>2021-07-28 20:21:41 +0100
commit46d02c2289e25460ec2f0d3c4e5c5eb7ab158119 (patch)
treefa2b3b1e77b164555d0bffc9d35c342cbb94b82d
parent1d681ca59cada118633c6e2d65b882b4c8f0db58 (diff)
downloadfstools-46d02c2289e25460ec2f0d3c4e5c5eb7ab158119.tar.gz
block: don't add non-ubifs ubi devices
As they require ubiblock to be mounted, just skip ubi devices in case they don't contain a ubifs. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
-rw-r--r--block.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/block.c b/block.c
index c9b61af..d839838 100644
--- a/block.c
+++ b/block.c
@@ -483,19 +483,27 @@ static int config_load(char *cfg)
static struct probe_info* _probe_path(char *path)
{
- struct probe_info *pr;
+ struct probe_info *pr, *epr;
char tmppath[64];
- /* skip ubi device if ubiblock device is present */
+ pr = probe_path(path);
+ if (!pr)
+ return NULL;
+
if (path[5] == 'u' && path[6] == 'b' && path[7] == 'i' &&
path[8] >= '0' && path[8] <= '9' ) {
+ /* skip ubi device if not UBIFS (as it requires ubiblock) */
+ if (strcmp("ubifs", pr->type))
+ return NULL;
+
+ /* skip ubi device if ubiblock device is present */
snprintf(tmppath, sizeof(tmppath), "/dev/ubiblock%s", path + 8);
- list_for_each_entry(pr, &devices, list)
- if (!strcasecmp(pr->dev, tmppath))
+ list_for_each_entry(epr, &devices, list)
+ if (!strcmp(epr->dev, tmppath))
return NULL;
}
- return probe_path(path);
+ return pr;
}
static int _cache_load(const char *path)