The current offset of cxt->dev_fd may not be still 0, notably when
blkdev_get_size has to resort to using blkdev_find_size
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org
DBG(CXT, ul_debugobj(cxt, "reading first sector "
"buffer [sector_size=%lu]", cxt->sector_size));
+ r = lseek(cxt->dev_fd, 0, SEEK_SET);
+ if (r == -1)
+ {
+ DBG(CXT, ul_debugobj(cxt, "failed to seek to first sector %m"));
+ return -errno;
+ }
+
r = read(cxt->dev_fd, cxt->firstsector, cxt->sector_size);
if (r != cxt->sector_size) {