On Friday 21 September 2007 17:37, Bernhard Fischer wrote:
> >> If LFS is off, then there really is no lseek64. Please revert.
> >
> >I tested both. On my glibc it works.
> >
> >I suppose it (maybe incorrectly) provides lseek64 even without
> >"#define _LARGEFILE64_SOURCE".
> >
> >Can you test whether fdisk.c compiles with LFS unset but with
> >#define _LARGEFILE64_SOURCE
> >added to the top of fdisk.c?
> 
> No, this will never help. I do not have and do not want LFS.

Please test attached patch.
--
vda
diff -d -urpN busybox.5/util-linux/fdisk.c busybox.6/util-linux/fdisk.c
--- busybox.5/util-linux/fdisk.c	2007-09-06 20:06:16.000000000 +0100
+++ busybox.6/util-linux/fdisk.c	2007-09-21 18:01:57.000000000 +0100
@@ -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
_______________________________________________
busybox mailing list
busybox@busybox.net
http://busybox.net/cgi-bin/mailman/listinfo/busybox

Reply via email to