block: don't truncate mountpoint path
[project/fstools.git] / block.c
diff --git a/block.c b/block.c
index 4d823e6bec562685c4b8770fab694f94271aa9dc..a06e2009ff97dc220c0904c97debda05745f211f 100644 (file)
--- 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));
 
@@ -743,7 +753,7 @@ static int mount_device(struct blkid_struct_probe *pr, int hotplug)
        }
 
        if (anon_mount) {
-               char target[] = "/mnt/mmcblk123";
+               char target[32];
                int err = 0;
 
                snprintf(target, sizeof(target), "/mnt/%s", device);
@@ -1267,7 +1277,7 @@ static int main_info(int argc, char **argv)
                        ULOG_ERR("failed to stat %s\n", argv[i]);
                        continue;
                }
-               if (!S_ISBLK(s.st_mode)) {
+               if (!S_ISBLK(s.st_mode) && !(S_ISCHR(s.st_mode) && major(s.st_rdev) == 250)) {
                        ULOG_ERR("%s is not a block device\n", argv[i]);
                        continue;
                }