Hi,

Adding Vangelis, the patch creator.

Vangelis, can you help? You can see all messages here[1].

[1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=886647

Regards,

Eriberto

Em seg, 29 de jan de 2018 às 10:51, Tim Phipps <[email protected]> escreveu:
>
>
> Hi,
> The cause of this bug is on
> debian/patches/10_fix-probing-of-large-block-devices.patch so it is
> Debian specific. The patch changes from using BLKGETSIZE to
> BLKGETSIZE64 without correcting for the fact that BLKGETSIZE returns
> the 512 byte sector size and BLKGETSIZE64 returns the byte size. This
> is from /usr/include/linux/fs.h:
>
> #define BLKGETSIZE _IO(0x12,96) /* return device size /512 (long *arg) */
> #define BLKGETSIZE64 _IOR(0x12,114,size_t)      /* return device size
> in bytes (u64 *arg) */
>
> and this is the patch:
> ===================================================================
> --- 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);
>   }
>
>
> Should be a trivial fix
> Cheers,
> Tim.

Reply via email to