Merge pull request #521 from ggruber/master

fix MAX_NUMBER_EXCLUDED_DRIVES, handle exceeding the limit, +README.md
This commit is contained in:
PartialVolume
2023-11-04 20:58:08 +00:00
committed by GitHub
4 changed files with 10 additions and 3 deletions

View File

@@ -116,7 +116,7 @@ dmidecode provides SMBIOS/DMI host data to stdout or the log file. If you don't
#### coreutils (provides readlink) [RECOMMENDED]
readlink determines the bus type, i.e. ATA, USB etc. Without it the --nousb option won't work and bus type information will be missing from nwipes selection and wipe windows. The coreutils package is often automatically installed as default in most if not all distros.
#### smartmontools [RECOMMENDED]
#### smartmontools [REQUIRED]
smartmontools obtains serial number information for supported USB to IDE/SATA adapters. Without it, drives plugged into USB ports will not show serial number information.
If you want a quick and easy way to keep your copy of nwipe running the latest master release of nwipe see the [automating the download and compilation](#automating-the-download-and-compilation-process-for-debian-based-distros) section.

View File

@@ -140,7 +140,7 @@ int check_device( nwipe_context_t*** c, PedDevice* dev, int dcount )
/* Check whether this drive is on the excluded drive list ? */
idx = 0;
while( idx < 10 )
while( idx < MAX_NUMBER_EXCLUDED_DRIVES )
{
if( !strcmp( dev->path, nwipe_options.exclude[idx++] ) )
{

View File

@@ -439,6 +439,13 @@ int nwipe_options_parse( int argc, char** argv )
}
}
}
if( idx_drive == MAX_NUMBER_EXCLUDED_DRIVES )
{
fprintf(
stderr,
"The number of excluded drives has reached the programs configured limit, aborting\n" );
exit( 130 );
}
}
break;

View File

@@ -35,7 +35,7 @@
#define NWIPE_KNOB_SCSI "/proc/scsi/scsi"
#define NWIPE_KNOB_SLEEP 1
#define NWIPE_KNOB_STAT "/proc/stat"
#define MAX_NUMBER_EXCLUDED_DRIVES 10
#define MAX_NUMBER_EXCLUDED_DRIVES 32
#define MAX_DRIVE_PATH_LENGTH 200 // e.g. /dev/sda is only 8 characters long, so 200 should be plenty.
#define DEFAULT_SYNC_RATE 100000
#define PATHNAME_MAX 2048