From: Samuel Thibault Date: Sun, 9 Nov 2014 02:19:01 +0000 (+0100) Subject: libfdisk: fdisk_read_firstsector should seek to offset 0 X-Git-Tag: v2.26-rc1~228 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a56b70f8ffb658a5a722c47cf77ea04c143fa0d9;p=thirdparty%2Futil-linux.git libfdisk: fdisk_read_firstsector should seek to offset 0 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 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) {