Skip to content

Commit

Permalink
Fix intermittent segfault when --logfile specified
Browse files Browse the repository at this point in the history
Under the following conditions a segfault will
occur upon starting nwipe.

Run nwipe with --logfile option AND run nwipe in a directory that does
not have write permissions so the logfile can't be created AND run nwipe
without sudo or root or as as a user without sufficient privileges so
you don't have permissions to write to the directory.
  • Loading branch information
PartialVolume committed Sep 29, 2023
1 parent 50951df commit f1fe7d6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 0 additions & 1 deletion src/logging.c
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,6 @@ void nwipe_log( nwipe_log_t level, const char* format, ... )
}
user_abort = 1;
terminate_signal = 1;
return;
}
}

Expand Down
6 changes: 4 additions & 2 deletions src/nwipe.c
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,10 @@ int main( int argc, char** argv )
nwipe_enumerated = nwipe_device_get( &c1, argv, argc );
if( nwipe_enumerated == 0 )
{
nwipe_log( NWIPE_LOG_ERROR, "Devices not found. Check you're not excluding drives unnecessarily." );
printf( "No drives found\n" );
nwipe_log( NWIPE_LOG_ERROR, "Devices not found. Check you're not excluding drives unnecessarily," );
nwipe_log( NWIPE_LOG_ERROR, "and you are running nwipe as sudo or as root." );
printf( "Devices not found, check you're not excluding drives unnecessarily \n and you are running nwipe "
"as sudo or as root." );
cleanup();
exit( 1 );
}
Expand Down

0 comments on commit f1fe7d6

Please sign in to comment.