Fix segfault & missing log lines

This patch fixes a segfault that occurs when a logfile is specified.
The segfault occurred on exit of nwipe. It did not affect the wipe
process.

This patch also fixes a related issue, at the end of a wipe some
of the log lines were missing on stdout, this occurred when a log
file was not specified as an option.
This commit is contained in:
PartialVolume
2019-12-10 23:29:42 +00:00
parent c7a565dbc8
commit a215aa14fa

View File

@@ -280,10 +280,6 @@ void nwipe_log( nwipe_log_t level, const char* format, ... )
{
printf( "%s\n", log_lines[log_current_element] );
}
else
{
log_current_element++;
}
} else
{
/* Open the log file for appending. */
@@ -343,6 +339,8 @@ void nwipe_log( nwipe_log_t level, const char* format, ... )
}
}
log_current_element++;
r = pthread_mutex_unlock( &mutex1 );
if ( r !=0 )
{