From 94a14b3585bad79deeff4df7d2c7b2499104e312 Mon Sep 17 00:00:00 2001 From: Christophe Grenier Date: Thu, 14 Jul 2022 09:23:29 +0200 Subject: [PATCH] src/hdaccess.c: make disk_get_sector_size variable local --- src/hdaccess.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/hdaccess.c b/src/hdaccess.c index faff4dd6..02fb922b 100644 --- a/src/hdaccess.c +++ b/src/hdaccess.c @@ -535,13 +535,12 @@ list_disk_t *hd_parse(list_disk_t *list_disk, const int verbose, const int testd @*/ static unsigned int disk_get_sector_size(const int hd_h, const char *device, const int verbose) { - unsigned int sector_size=0; #ifdef BLKSSZGET { int arg=0; if (ioctl(hd_h, BLKSSZGET, &arg) == 0) { - sector_size=arg; + const unsigned int sector_size=arg; if(verbose>1) { log_verbose("disk_get_sector_size BLKSSZGET %s sector_size=%u\n", device, sector_size); @@ -556,7 +555,7 @@ static unsigned int disk_get_sector_size(const int hd_h, const char *device, con unsigned int arg=0; if(ioctl(hd_h,DIOCGSECTORSIZE,&arg)==0) { - sector_size=arg; + const unsigned int sector_size=arg; if(verbose>1) { log_verbose("disk_get_sector_size DIOCGSECTORSIZE %s sector_size=%u\n",device,sector_size); @@ -571,7 +570,7 @@ static unsigned int disk_get_sector_size(const int hd_h, const char *device, con struct disklabel geometry; if (ioctl(hd_h, DIOCGDINFO, &geometry)==0) { /* I can get the geometry */ - sector_size=geometry.d_secsize; + const unsigned int sector_size=geometry.d_secsize; if(verbose>1) { log_verbose("disk_get_sector_size DIOCGDINFO %s Ok\n",device); @@ -587,7 +586,7 @@ static unsigned int disk_get_sector_size(const int hd_h, const char *device, con uint32_t arg=0; if(ioctl(hd_h,DKIOCGETBLOCKSIZE,&arg)==0) { - sector_size=arg; + const unsigned int sector_size=arg; if(verbose>1) { log_verbose("disk_get_sector_size DKIOCGETBLOCKSIZE %s sector_size=%u\n", @@ -610,7 +609,7 @@ static unsigned int disk_get_sector_size(const int hd_h, const char *device, con &dwFreeClusters, &dwTotalClusters)!=0) { - sector_size=dwBytesPerSect; + const unsigned int sector_size=dwBytesPerSect; if(verbose>1) { log_verbose("disk_get_sector_size GetDiskFreeSpaceA %s Ok\n",device);