int exfat_mount(struct exfat* ef, const char* spec, const char* options)
{
int rc;
+ struct stat stbuf;
tzset();
memset(ef, 0, sizeof(struct exfat));
exfat_error("failed to open `%s'", spec);
return -EIO;
}
+ if (fstat(ef->fd, &stbuf) != 0)
+ {
+ close(ef->fd);
+ free(ef->sb);
+ exfat_error("failed to fstat `%s'", spec);
+ return -EIO;
+ }
+ if (!S_ISBLK(stbuf.st_mode) && !S_ISREG(stbuf.st_mode))
+ {
+ close(ef->fd);
+ free(ef->sb);
+ exfat_error("`%s' is neither a block device, nor a regular file",
+ spec);
+ return -EIO;
+ }
exfat_read_raw(ef->sb, sizeof(struct exfat_super_block), 0, ef->fd);
if (memcmp(ef->sb->oem_name, "EXFAT ", 8) != 0)