]> git.sven.stormbind.net Git - sven/exfat-utils.git/blobdiff - dump/main.c
Imported Upstream version 0.9.7
[sven/exfat-utils.git] / dump / main.c
index 357557d6ee2af4dfa0a4dda46f85d1b9d835c42f..cd424d902fae55a1721ed9ca7e4e71331874bec7 100644 (file)
@@ -73,23 +73,22 @@ static void print_other_info(const struct exfat_super_block* sb)
 
 static int dump_sb(const char* spec)
 {
-       int fd;
+       struct exfat_dev* dev;
        struct exfat_super_block sb;
 
-       fd = exfat_open(spec, 1);
-       if (fd < 0)
+       dev = exfat_open(spec, 1);
+       if (dev == NULL)
                return 1;
 
-       if (read(fd, &sb, sizeof(struct exfat_super_block))
-                       != sizeof(struct exfat_super_block))
+       if (exfat_read(dev, &sb, sizeof(struct exfat_super_block)) < 0)
        {
-               close(fd);
+               exfat_close(dev);
                exfat_error("failed to read from `%s'", spec);
                return 1;
        }
        if (memcmp(sb.oem_name, "EXFAT   ", sizeof(sb.oem_name)) != 0)
        {
-               close(fd);
+               exfat_close(dev);
                exfat_error("exFAT file system is not found on `%s'", spec);
                return 1;
        }
@@ -99,7 +98,7 @@ static int dump_sb(const char* spec)
        print_cluster_info(&sb);
        print_other_info(&sb);
 
-       close(fd);
+       exfat_close(dev);
        return 0;
 }