aboutsummaryrefslogtreecommitdiffstats
path: root/libexfat/io.c
diff options
context:
space:
mode:
authorrelan <relan@users.noreply.github.com>2012-12-29 08:01:07 +0000
committerrelan <relan@users.noreply.github.com>2015-08-24 08:26:15 +0300
commite54bdeed8dd56d163105455a1415940a0cd7620d (patch)
tree128ff130c91eb325d43a6c484306a169e62b3d4e /libexfat/io.c
parent074a8f077c584a4a30f7f31f0d2f5de74350ff69 (diff)
downloadandroid_external_exfat-e54bdeed8dd56d163105455a1415940a0cd7620d.tar.gz
android_external_exfat-e54bdeed8dd56d163105455a1415940a0cd7620d.tar.bz2
android_external_exfat-e54bdeed8dd56d163105455a1415940a0cd7620d.zip
Seek to the beginning of the device after detecting its size.
dumpexfat relies on this.
Diffstat (limited to 'libexfat/io.c')
-rw-r--r--libexfat/io.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/libexfat/io.c b/libexfat/io.c
index 886dd23..274dbef 100644
--- a/libexfat/io.c
+++ b/libexfat/io.c
@@ -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