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: Scott Dwyer
Subject: Re: [Bug-ddrescue] 2 Suggestions (bi-directional retry and user interruption exit code)
Date: Thu, 13 Feb 2014 17:34:36 -0500
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0


On 2/13/2014 3:08 PM, Florian Sedivy wrote:
To be honest, I don't know, where the return value actually comes from. The comments on 
the start of Rescuebook functions are stating "// Return values: 1 I/O error, 0 OK, 
-1 interrupted, -2 logfile error" so thats what I blindly believed. The line I found 
neutralizes anything negative to zero, so deleting that line would just pass through 
whatever comes along.

Before I applied that patch I had a hard time getting out of a scripted 
retry-loop …

Interesting. Not sure if I have tried to see what is returned from a bash script, but the following C code from ddru_ntfsbitmap works to tell if ddrescue was terminated:

  char command[512];
sprintf (command, "ddrescue %s -i%lld -o%lld -s%lld %s \'%s\' \'%s\'", ddrescue_options, input_offset, output_offset, data_size, source_disk, destination_file, log_file);

  return_value = system (command);
  if (return_value > 255)
    return_value = return_value / 256;

  if (return_value == 2)
     {
       fprintf (stderr, "\nddresuce was terminated by the user\n");
       exit(return_value);
     }
I too would like to see a specific exit code for being terminated by the user, even though what I have seems to work for me. Although I would need to know when you do it, as I have to make sure it doesn't break my code.

While we are on the subject of modifying exit codes, I would REALLY like a separate exit code for an unfinished recovery. Maybe as an option, but would do the same thing as the --done-status in ddrescuelog. Would save me time from having to call ddrescuelog after ddrescue.

Scott



reply via email to

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