OSDN Git Service

Seek to the beginning of the device after detecting its size (dumpexfat relies on...
authorresver <resver@60bc1c72-a15a-11de-b98f-4500b42dc123>
Sat, 29 Dec 2012 08:01:07 +0000 (08:01 +0000)
committerresver <resver@60bc1c72-a15a-11de-b98f-4500b42dc123>
Sat, 29 Dec 2012 08:01:07 +0000 (08:01 +0000)
git-svn-id: http://exfat.googlecode.com/svn/trunk@322 60bc1c72-a15a-11de-b98f-4500b42dc123

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