From 0ffc12ec0f7a1312508ae9a142f4cd7c7601bc73 Mon Sep 17 00:00:00 2001 From: Alexandre Dulaunoy Date: Wed, 26 Nov 2014 21:55:23 +0100 Subject: [PATCH] Debian fix-probing-of-large-block-devices.patch added --- sizeprobe.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/sizeprobe.c b/sizeprobe.c index 6c3c248..6ba5eb8 100644 --- a/sizeprobe.c +++ b/sizeprobe.c @@ -63,9 +63,13 @@ static off_t midpoint(off_t a, off_t b, long blksize) 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); }