From f57dee09fb077a8fda1215e2549740f223cb4ec6 Mon Sep 17 00:00:00 2001 From: Kinglong Mee Date: Sat, 18 Mar 2017 16:00:10 +0800 Subject: [PATCH] libf2fs: avoid overwrite the c.start_sector by non-root device For multiple devices, the c.start_sector will be overwrite by the non-root devices. Signed-off-by: Kinglong Mee Signed-off-by: Jaegeuk Kim --- lib/libf2fs.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/libf2fs.c b/lib/libf2fs.c index 93d3da9..bb32df8 100644 --- a/lib/libf2fs.c +++ b/lib/libf2fs.c @@ -730,10 +730,12 @@ int get_device_info(int i) #endif dev->total_sectors /= dev->sector_size; - if (ioctl(fd, HDIO_GETGEO, &geom) < 0) - c.start_sector = 0; - else - c.start_sector = geom.start; + if (i == 0) { + if (ioctl(fd, HDIO_GETGEO, &geom) < 0) + c.start_sector = 0; + else + c.start_sector = geom.start; + } #ifndef WITH_ANDROID /* Send INQUIRY command */ -- 2.7.4