make the block tool ignore case when comparing uuid strings
[project/fstools.git] / block.c
diff --git a/block.c b/block.c
index 9122ebf..8bb77aa 100644 (file)
--- a/block.c
+++ b/block.c
@@ -354,7 +354,7 @@ static struct mount* find_swap(const char *uuid, const char *label, const char *
        vlist_for_each_element(&mounts, m, node) {
                if (m->type != TYPE_SWAP)
                        continue;
        vlist_for_each_element(&mounts, m, node) {
                if (m->type != TYPE_SWAP)
                        continue;
-               if (uuid && m->uuid && !strcmp(m->uuid, uuid))
+               if (uuid && m->uuid && !strcasecmp(m->uuid, uuid))
                        return m;
                if (label && m->label && !strcmp(m->label, label))
                        return m;
                        return m;
                if (label && m->label && !strcmp(m->label, label))
                        return m;
@@ -373,7 +373,7 @@ static struct mount* find_block(const char *uuid, const char *label, const char
        vlist_for_each_element(&mounts, m, node) {
                if (m->type != TYPE_MOUNT)
                        continue;
        vlist_for_each_element(&mounts, m, node) {
                if (m->type != TYPE_MOUNT)
                        continue;
-               if (m->uuid && uuid && !strcmp(m->uuid, uuid))
+               if (m->uuid && uuid && !strcasecmp(m->uuid, uuid))
                        return m;
                if (m->label && label && !strcmp(m->label, label))
                        return m;
                        return m;
                if (m->label && label && !strcmp(m->label, label))
                        return m;
@@ -474,12 +474,15 @@ static int _cache_load(const char *path)
 
 static void cache_load(int mtd)
 {
 
 static void cache_load(int mtd)
 {
-       if (mtd)
+       if (mtd) {
                _cache_load("/dev/mtdblock*");
                _cache_load("/dev/mtdblock*");
+               _cache_load("/dev/ubiblock*");
+       }
        _cache_load("/dev/mmcblk*");
        _cache_load("/dev/sd*");
        _cache_load("/dev/hd*");
        _cache_load("/dev/md*");
        _cache_load("/dev/mmcblk*");
        _cache_load("/dev/sd*");
        _cache_load("/dev/hd*");
        _cache_load("/dev/md*");
+       _cache_load("/dev/vd*");
        _cache_load("/dev/mapper/*");
 }
 
        _cache_load("/dev/mapper/*");
 }
 
@@ -526,7 +529,7 @@ static struct blkid_struct_probe* find_block_info(char *uuid, char *label, char
 
        if (uuid)
                list_for_each_entry(pr, &devices, list)
 
        if (uuid)
                list_for_each_entry(pr, &devices, list)
-                       if (!strcmp(pr->uuid, uuid))
+                       if (!strcasecmp(pr->uuid, uuid))
                                return pr;
 
        if (label)
                                return pr;
 
        if (label)
@@ -856,7 +859,7 @@ static int check_extroot(char *path)
 
                        fgets(uuid, sizeof(uuid), fp);
                        fclose(fp);
 
                        fgets(uuid, sizeof(uuid), fp);
                        fclose(fp);
-                       if (!strcmp(uuid, pr->uuid))
+                       if (!strcasecmp(uuid, pr->uuid))
                                return 0;
                        ERROR("extroot: uuid tag does not match rom uuid\n");
                }
                                return 0;
                        ERROR("extroot: uuid tag does not match rom uuid\n");
                }