Skip to contentSkip to conversation

libf2fs: avoid overwrite the c.start_sector by non-root device

PATCH New Kinglong Mee 1 participant 1 message Mar 18, 2017 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 lib/libf2fs.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
lib/libf2fs.c +6 -4
index 93d3da9..bb32df8 100644
@@ -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 */
Signature · 6 lines
2.9.3


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot