make fdisk compile on libc without llseek64
authorDenis Vlasenko <vda.linux@googlemail.com>
Sun, 23 Sep 2007 14:05:54 +0000 (14:05 -0000)
committerDenis Vlasenko <vda.linux@googlemail.com>
Sun, 23 Sep 2007 14:05:54 +0000 (14:05 -0000)
util-linux/fdisk.c

index 2a91a8f2f5cf7855ac1312731f6bd28fdd8aaafe..7981abc9f22477b1cbe990585471338adb9f0b57 100644 (file)
@@ -638,8 +638,16 @@ static void
 seek_sector(ullong secno)
 {
        secno *= sector_size;
+#if ENABLE_FDISK_SUPPORT_LARGE_DISKS
        if (lseek64(fd, (off64_t)secno, SEEK_SET) == (off64_t) -1)
                fdisk_fatal(unable_to_seek);
+#else
+       if (secno > MAXINT(off_t)
+        || lseek(fd, (off_t)secno, SEEK_SET) == (off_t) -1
+       ) {
+               fdisk_fatal(unable_to_seek);
+       }
+#endif
 }
 
 #if ENABLE_FEATURE_FDISK_WRITABLE