OSDN Git Service

Seek to the beginning of the device after detecting its size.
authorrelan <relan@users.noreply.github.com>
Sat, 29 Dec 2012 08:01:07 +0000 (08:01 +0000)
committerrelan <relan@users.noreply.github.com>
Mon, 24 Aug 2015 05:26:15 +0000 (08:26 +0300)
dumpexfat relies on this.

libexfat/io.c

index 886dd23..274dbef 100644 (file)
@@ -176,6 +176,13 @@ struct exfat_dev* exfat_open(const char* spec, enum exfat_mode mode)
                        exfat_error("failed to get size of `%s'", spec);
                        return NULL;
                }
+               if (exfat_seek(dev, 0, SEEK_SET) == -1)
+               {
+                       close(dev->fd);
+                       free(dev);
+                       exfat_error("failed to seek to the beginning of `%s'", spec);
+                       return NULL;
+               }
        }
 
 #ifdef USE_UBLIO