diff --git a/src/pass.c b/src/pass.c index f3a3f15..01a8c87 100644 --- a/src/pass.c +++ b/src/pass.c @@ -391,6 +391,13 @@ int nwipe_random_pass( NWIPE_METHOD_SIGNATURE ) } /* partial write */ + /* Decrement the bytes remaining in this pass. */ + z -= r; + + /* Increment the total progress counters. */ + c->pass_done += r; + c->round_done += r; + /* Perodic Sync */ if( syncRate > 0 ) { @@ -427,19 +434,12 @@ int nwipe_random_pass( NWIPE_METHOD_SIGNATURE ) pthread_testcancel(); - /* Decrement the bytes remaining in this pass. */ - z -= r; - /* If statement required so that it does not reset on subsequent passes */ if( c->bytes_erased < ( c->device_size - z ) ) // How much of the device has been erased? { c->bytes_erased = c->device_size - z; } - /* Increment the total progress counters. */ - c->pass_done += r; - c->round_done += r; - } /* remaining bytes */ /* Release the output buffer. */ @@ -834,6 +834,13 @@ int nwipe_static_pass( NWIPE_METHOD_SIGNATURE, nwipe_pattern_t* pattern ) * then ( w == 0 ) always. */ + /* Decrement the bytes remaining in this pass. */ + z -= r; + + /* Increment the total progress counterr. */ + c->pass_done += r; + c->round_done += r; + /* Perodic Sync */ if( syncRate > 0 ) { @@ -870,18 +877,11 @@ int nwipe_static_pass( NWIPE_METHOD_SIGNATURE, nwipe_pattern_t* pattern ) pthread_testcancel(); - /* Decrement the bytes remaining in this pass. */ - z -= r; - if( c->bytes_erased < ( c->device_size - z ) ) // How much of the device has been erased? { c->bytes_erased = c->device_size - z; } - /* Increment the total progress counterr. */ - c->pass_done += r; - c->round_done += r; - } /* remaining bytes */ /* Tell our parent that we are syncing the device. */