f2fs-tools: handle /sys is not mounted
authorJaegeuk Kim <jaegeuk@kernel.org>
Thu, 2 Jan 2020 18:44:42 +0000 (10:44 -0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Tue, 14 Jan 2020 15:42:02 +0000 (07:42 -0800)
Format a partition, even if /sys is not mounted.

Reported-by: David Heidelberg <david@ixit.cz>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
lib/libf2fs_zoned.c

index e58d3ce..efc687c 100644 (file)
@@ -97,8 +97,9 @@ int f2fs_get_zoned_model(int i)
        /* Check that this is a zoned block device */
        res = get_sysfs_path(dev, "queue/zoned", str, sizeof(str));
        if (res != 0) {
-               MSG(0, "\tError: Failed to get device sysfs path\n");
-               return -1;
+               MSG(0, "\tInfo: can't find /sys, assuming normal block device\n");
+               dev->zoned_model = F2FS_ZONED_NONE;
+               return 0;
        }
 
        file = fopen(str, "r");