nwipe_log format specifier doesn't match variable.

The format specifier didn't match the size of the variable that holds
c2[i]->device_sector_size which is an int. This didn't appear to cause
a problem with reporting in a 64 bit build. It does cause a problem in
a 32 bit build displaying a very large & incorrect number for sector,
block and device sizes.

This doesn't cause any issues with the overall function, simply
incorrect sector, block and device sizes in 32 bit builds as displayed
in the nwipe log.

I also changed the signed long long for c2[i]->device _size to a
unsigned long long as there is little point in a negative device size.
This commit is contained in:
PartialVolume
2021-12-01 19:20:34 +00:00
parent aab863ea7d
commit 181ef543de
3 changed files with 4 additions and 4 deletions

View File

@@ -93,7 +93,7 @@ typedef struct nwipe_context_t_
char* device_name; // The device file name.
char device_name_without_path[100];
char gui_device_name[100];
long long device_size; // The device size in bytes.
unsigned long long device_size; // The device size in bytes.
char* device_size_text; // The device size in a more (human)readable format.
char device_size_txt[NWIPE_DEVICE_SIZE_TXT_LENGTH]; // The device size in a more (human)readable format.
char* device_model; // The model of the device.

View File

@@ -445,7 +445,7 @@ int main( int argc, char** argv )
if( c2[i]->device_size == 0 )
{
nwipe_log( NWIPE_LOG_ERROR,
"%s, sect/blk/dev %llu/%i/%llu",
"%s, sect/blk/dev %i/%i/%llu",
c2[i]->device_name,
c2[i]->device_sector_size,
c2[i]->device_block_size,

View File

@@ -4,7 +4,7 @@
* used by configure to dynamically assign those values
* to documentation files.
*/
const char* version_string = "0.32.014";
const char* version_string = "0.32.015";
const char* program_name = "nwipe";
const char* author_name = "Martijn van Brummelen";
const char* email_address = "git@brumit.nl";
@@ -14,4 +14,4 @@ Modifications to original dwipe Copyright Andy Beverley <andy@andybev.com>\n\
This is free software; see the source for copying conditions.\n\
There is NO warranty; not even for MERCHANTABILITY or FITNESS\n\
FOR A PARTICULAR PURPOSE.\n";
const char* banner = "nwipe 0.32.014";
const char* banner = "nwipe 0.32.015";