X-Git-Url: https://git.sven.stormbind.net/?p=sven%2Fexfatprogs.git;a=blobdiff_plain;f=lib%2Flibexfat.c;h=c1c9b037c612a4e6bc24704aace55e6a4aaa529c;hp=c54a7c8dc23bdb067acd218c9f1c28834b3da92b;hb=dcb4e80c267579d1a68e3f34f6b750e2940dbcc2;hpb=20b882b37d525f27c85037871c4f35f7ad2c55ba diff --git a/lib/libexfat.c b/lib/libexfat.c index c54a7c8..c1c9b03 100644 --- a/lib/libexfat.c +++ b/lib/libexfat.c @@ -475,8 +475,7 @@ int exfat_read_sector(struct exfat_blk_dev *bd, void *buf, unsigned int sec_off) int ret; unsigned long long offset = sec_off * bd->sector_size; - lseek(bd->dev_fd, offset, SEEK_SET); - ret = read(bd->dev_fd, buf, bd->sector_size); + ret = pread(bd->dev_fd, buf, bd->sector_size, offset); if (ret < 0) { exfat_err("read failed, sec_off : %u\n", sec_off); return -1; @@ -490,8 +489,7 @@ int exfat_write_sector(struct exfat_blk_dev *bd, void *buf, int bytes; unsigned long long offset = sec_off * bd->sector_size; - lseek(bd->dev_fd, offset, SEEK_SET); - bytes = write(bd->dev_fd, buf, bd->sector_size); + bytes = pwrite(bd->dev_fd, buf, bd->sector_size, offset); if (bytes != (int)bd->sector_size) { exfat_err("write failed, sec_off : %u, bytes : %d\n", sec_off, bytes);