[Patch] Segfault on unaligned lseek() on /dev/sdX (was: [ITP] ddrescue 1.3)

Christian Franke Christian.Franke@t-online.de
Fri May 18 20:23:00 GMT 2007

Christopher Faylor wrote:
> On Fri, May 18, 2007 at 09:02:15PM +0200, Christian Franke wrote:
>> ...
> It seems like this could be done without the heavyweight use of malloc,
> like use an automatic array of length 512 + 4 and calculate an aligned
> address from that.

Sorry, no. "unaligned seek" does not refer to memory here.

It should mean "seek position not aligned to raw device sector size".
This is 2048 for CD/DVD and results in a segfault.
Windows may even report larger sizes in DISK_GEOMETRY_EX.BytesPerSector.

Possible slow speed in the unaligned case is IMO a minor issue .
For maximum speed, the related tools like dd can easily be configured to 
read (a multiple of) sector size.


More information about the Cygwin-patches mailing list