Skip to content

Commit

Permalink
Merge pull request martijnvanbrummelen#496 from ggruber/master
Browse files Browse the repository at this point in the history
bustype detection with smartctl works (again?)
  • Loading branch information
PartialVolume authored Oct 6, 2023
2 parents c6ff341 + f764c39 commit 525cf03
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ int nwipe_conf_init()
root = config_root_setting( &nwipe_cfg );
char nwipe_customers_initial_content[] =
"\"Customer Name\";\"Contact Name\";\"Customer Address\";\"Contact Phone\"\n"
"\"Not Applicable\";\"Not Applicable\";\"Not Applicable\";\"Not Applicable\"";
"\"Not Applicable\";\"Not Applicable\";\"Not Applicable\";\"Not Applicable\"\n";

/* Read /etc/nwipe/nwipe.conf. If there is an error, determine whether
* it's because it doesn't exist. If it doesn't exist create it and
Expand Down
11 changes: 10 additions & 1 deletion src/device.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

#include <stdio.h>
#include <stdint.h>
#include <ctype.h>

#include "nwipe.h"
#include "context.h"
Expand Down Expand Up @@ -711,7 +712,7 @@ int nwipe_get_device_bus_type_and_serialno( char* device, nwipe_device_t* bus, c
/* If upper case alpha character, change to lower case */
if( result[idx] >= 'A' && result[idx] <= 'Z' )
{
result[idx] += 32;
result[idx] = tolower( result[idx] );
}

idx++;
Expand Down Expand Up @@ -775,6 +776,10 @@ int nwipe_get_device_bus_type_and_serialno( char* device, nwipe_device_t* bus, c
{
/* strip any leading or trailing spaces and left justify, +4 is the length of "bus type:" */
trim( &result[19] );
for( idx = 19; result[idx]; idx++ )
{
result[idx] = tolower( result[idx] );
}

if( strncmp( &result[19], "sas", 3 ) == 0 )
{
Expand All @@ -787,6 +792,10 @@ int nwipe_get_device_bus_type_and_serialno( char* device, nwipe_device_t* bus, c

/* strip any leading or trailing spaces and left justify, +4 is the length of "bus type:" */
trim( &result[16] );
for( idx = 16; result[idx]; idx++ )
{
result[idx] = tolower( result[idx] );
}

if( strncmp( &result[16], "sata", 4 ) == 0 )
{
Expand Down

0 comments on commit 525cf03

Please sign in to comment.