Skip to content

Commit

Permalink
fix MAX_NUMBER_EXCLUDED_DRIVES, handle exceeding the limit, +README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
ggruber committed Nov 4, 2023
1 parent e463b10 commit e77164f
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion src/device.c
Original file line number Diff line number Diff line change
Expand Up @@ -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++] ) )
{
Expand Down
7 changes: 7 additions & 0 deletions src/options.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion src/options.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e77164f

Please sign in to comment.