Hello again,

Heikki Tauriainen wrote:
To protect the code from a buffer alignment failure whose occurrence depends on the buffer's address (which is not guaranteed to remain consistent between invocations of the program), I think it would be safer to compute "disp" using unsigned arithmetic on an integral type
large enough to hold the address of the buffer.

The problem is that the C++ standard does not guarantee that such integral type exists in all implementations. 'intptr_t/uintptr_t' are optional in C++11 and do not exist in C++03. (The alignment code of ddrescue was written in 2005).

I have released version 1.21-pre3 using a cast to 'unsigned long long', a type already used by ddrescue that most probably will be able to contain the pointer value.


Alternatively, the program could (as a sanity check) abort with an
error in case the buffer cannot be adjusted to a multiple of the
sector size for direct disk access, or give more debug information
about the failing read(2) requests, instead of failing silently in
this case.

In a few days I'll add some code to make ddrescue exit on EINVAL and report an error.


Thanks again,
Antonio.

_______________________________________________
Bug-ddrescue mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-ddrescue

Reply via email to