dcfldd/debian/patches/fix-probing-of-large-block-devices.patch

25 lines
909 B
Diff
Raw Normal View History

2014-11-26 21:01:30 +00:00
Description: fix size probing of large block devices.
Author: Vangelis Koukis <vkoukis@gmail.com>
Last-Update: 2014-08-03
Index: dcfldd-1.3.4.1/sizeprobe.c
===================================================================
--- dcfldd-1.3.4.1.orig/sizeprobe.c
+++ dcfldd-1.3.4.1/sizeprobe.c
@@ -63,9 +63,13 @@ static off_t midpoint(off_t a, off_t b,
static off_t get_dev_size(int fd, long blksize)
{
off_t num_sectors = 0;
-
- if (ioctl(fd, BLKGETSIZE, &num_sectors))
- log_info("%s: ioctl call to BLKGETSIZE failed.\n", program_name);
+
+ /*
+ * Use BLKGETSIZE64 unconditionally, since dcfldd.h #defines _FILE_OFFSET_BITS 64
+ * and off_t is guaranteed to be large enough to hold the result.
+ */
+ if (ioctl(fd, BLKGETSIZE64, &num_sectors))
+ log_info("%s: ioctl call to BLKGETSIZE64 failed.\n", program_name);
else
return (num_sectors * 512);
}