bug-ddrescue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-ddrescue] 2 Suggestions (bi-directional retry and user interrup


From: Antonio Diaz Diaz
Subject: Re: [Bug-ddrescue] 2 Suggestions (bi-directional retry and user interruption exit code)
Date: Mon, 24 Feb 2014 16:23:19 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i586; en-US; rv:1.7.11) Gecko/20050905

Scott Dwyer wrote:
You mentioned thinking about raising SIGNT for interrupted ddrescue exit . I did not try that, and would have to look into how. But what might it break? I don't want anything to get broken for anybody else.

ASAP I'll release a new version using this method. Meanwhile you can try the patch below. The real thing will be different because ddrescue uses 'sigaction' instead of 'signal' and because real error codes during cleanup should have preference over user interrupt, but I expect this patch to be enough for a test.


Is there another way that would work? I am open to anything that would work and be consistent. Even if it means adding an option for advanced users to get a different return value.

If for some reason raising a signal creates problems, adding an option would be my next choice.


Best regards,
Antonio.

--- rescuebook.cc~      2014-02-01 00:28:19.000000000 +0100
+++ rescuebook.cc       2014-02-24 16:00:00.000000000 +0100
@@ -736,7 +736,6 @@
   else
     {
     if( retval == 0 ) current_status( finished );
-    else if( retval < 0 ) retval = 0;          // interrupted by user
     if( !extend_outfile_size() )               // sparse or -x option
       {
       show_error( "Error extending output file size." );
@@ -754,5 +753,7 @@
   if( !read_logger.close_file() )
     show_error( "warning: Error closing the reads logging file." );
   if( final_msg() ) show_error( final_msg(), final_errno() );
-  return retval;
+  if( retval >= 0 ) return retval;
+  std::signal( SIGINT, SIG_DFL );
+  std::raise( SIGINT );
   }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]