>From f3e1018d306f607676e6695ea8864b77bbddcb58 Mon Sep 17 00:00:00 2001 From: Andreas Oberritter Date: Tue, 12 Oct 2010 00:42:59 +0200 Subject: [PATCH 4/4] linux: fail if drive does not respond to identify command --- rescuebook.cc | 20 ++++++++++++++++++++ 1 files changed, 20 insertions(+), 0 deletions(-) diff --git a/rescuebook.cc b/rescuebook.cc index b54fa40..0774f6f 100644 --- a/rescuebook.cc +++ b/rescuebook.cc @@ -29,6 +29,10 @@ #include "block.h" #include "ddrescue.h" +#if defined(__linux__) +#include +#include +#endif // Return values: 0 OK, -1 interrupted, -2 logfile error. // @@ -118,6 +122,22 @@ int Rescuebook::copy_and_update( const Block & b, const Sblock::Status st, final_msg( "input file disappeared" ); final_errno( errno ); retval = 1; } +#if defined(__linux__) + else + { + unsigned char args[4 + 512]; + args[0] = 0xec; // COMMAND + args[1] = 0; // SECTOR + args[2] = 0; // FEATURE + args[3] = 1; // NSECTOR + memset(&args[4], 0, 512); + if(ioctl(ides_, HDIO_DRIVE_CMD, args) < 0) + { + final_msg( "input drive does not identify" ); final_errno( errno ); + retval = 1; + } + } +#endif } } return retval; -- 1.7.0.4