diff --git a/src/create_pdf.c b/src/create_pdf.c index f548066..d174375 100644 --- a/src/create_pdf.c +++ b/src/create_pdf.c @@ -60,6 +60,7 @@ int create_pdf( nwipe_context_t* ptr ) char HPA_post_erase[50] = ""; char DCO_pre_erase[50] = ""; char DCO_post_erase[50] = ""; + char errors[50] = ""; char throughput_txt[50] = ""; struct pdf_info info = { .creator = "https://github.com/PartialVolume/shredos.x86_64", @@ -366,8 +367,22 @@ int create_pdf( nwipe_context_t* ptr ) pdf_add_text( pdf, NULL, throughput_txt, 12, 370, 170, PDF_BLACK ); pdf_set_font( pdf, "Helvetica" ); + /* Errors */ + pdf_add_text( pdf, NULL, "Errors(pass/sync/verify):", 12, 60, 170, PDF_GRAY ); + pdf_set_font( pdf, "Helvetica-Bold" ); + snprintf( errors, sizeof( errors ), "%llu/%llu/%llu", c->pass_errors, c->fsyncdata_errors, c->verify_errors ); + if( c->pass_errors != 0 || c->fsyncdata_errors != 0 || c->verify_errors != 0 ) + { + pdf_add_text( pdf, NULL, errors, 12, 195, 170, PDF_RED ); + } + else + { + pdf_add_text( pdf, NULL, errors, 12, 195, 170, PDF_DARK_GREEN ); + } + pdf_set_font( pdf, "Helvetica" ); + /* Information */ - pdf_add_text( pdf, NULL, "Information:", 12, 60, 170, PDF_GRAY ); + pdf_add_text( pdf, NULL, "Information:", 12, 60, 150, PDF_GRAY ); pdf_set_font( pdf, "Helvetica-Bold" ); pdf_add_text( pdf, NULL, "* bytes erased: The amount of drive that's been erased at least once", 12, 60, 130, PDF_BLACK ); diff --git a/src/logging.c b/src/logging.c index 244b5e1..48c1385 100644 --- a/src/logging.c +++ b/src/logging.c @@ -406,9 +406,6 @@ void nwipe_perror( int nwipe_errno, const char* f, const char* s ) { /** * Wrapper for perror(). - * - * We may wish to tweak or squelch this later. - * */ nwipe_log( NWIPE_LOG_ERROR, "%s: %s: %s", f, s, strerror( nwipe_errno ) ); diff --git a/src/pass.c b/src/pass.c index 01a8c87..9c730da 100644 --- a/src/pass.c +++ b/src/pass.c @@ -127,7 +127,6 @@ int nwipe_random_verify( nwipe_context_t* c ) if( r != 0 ) { - /* FIXME: Is there a better way to handle this? */ nwipe_perror( errno, __FUNCTION__, "fdatasync" ); nwipe_log( NWIPE_LOG_WARNING, "Buffer flush failure on '%s'.", c->device_name ); c->fsyncdata_errors++; @@ -440,7 +439,7 @@ int nwipe_random_pass( NWIPE_METHOD_SIGNATURE ) c->bytes_erased = c->device_size - z; } - } /* remaining bytes */ + } /* /remaining bytes */ /* Release the output buffer. */ free( b ); @@ -456,7 +455,6 @@ int nwipe_random_pass( NWIPE_METHOD_SIGNATURE ) if( r != 0 ) { - /* FIXME: Is there a better way to handle this? */ nwipe_perror( errno, __FUNCTION__, "fdatasync" ); nwipe_log( NWIPE_LOG_WARNING, "Buffer flush failure on '%s'.", c->device_name ); c->fsyncdata_errors++; @@ -556,7 +554,6 @@ int nwipe_static_verify( NWIPE_METHOD_SIGNATURE, nwipe_pattern_t* pattern ) if( r != 0 ) { - /* FIXME: Is there a better way to handle this? */ nwipe_perror( errno, __FUNCTION__, "fdatasync" ); nwipe_log( NWIPE_LOG_WARNING, "Buffer flush failure on '%s'.", c->device_name ); c->fsyncdata_errors++; @@ -882,7 +879,7 @@ int nwipe_static_pass( NWIPE_METHOD_SIGNATURE, nwipe_pattern_t* pattern ) c->bytes_erased = c->device_size - z; } - } /* remaining bytes */ + } /* /remaining bytes */ /* Tell our parent that we are syncing the device. */ c->sync_status = 1;