mirror of
https://github.com/freebsd/freebsd-src.git
synced 2026-10-30 20:35:03 +01:00
MFC: 1.36: use off_t for the size variable used to calculate the size of
the partition and use ULL suffix for constants to ensure that we use 64 bit math to reduce overflow in disk space calculations
This commit is contained in:
1 parent
e93ceeb90a
commit
c4c5594de8
1 file changed
+5
-5
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/stable/4/; revision=73611
@@ -1331,7 +1331,7 @@ checklabel(lp)
|
||||
register struct partition *pp;
|
||||
int i, errors = 0;
|
||||
char part;
|
||||
unsigned long total_size,total_percent,current_offset;
|
||||
unsigned long total_size, total_percent, current_offset;
|
||||
int seen_default_offset;
|
||||
int hog_part;
|
||||
int j;
|
||||
@@ -1394,7 +1394,7 @@ checklabel(lp)
|
||||
}
|
||||
} else {
|
||||
char *type;
|
||||
unsigned long size;
|
||||
off_t size;
|
||||
|
||||
size = pp->p_size;
|
||||
switch (part_size_type[i]) {
|
||||
@@ -1403,15 +1403,15 @@ checklabel(lp)
|
||||
break;
|
||||
case 'k':
|
||||
case 'K':
|
||||
size *= 1024UL;
|
||||
size *= 1024ULL;
|
||||
break;
|
||||
case 'm':
|
||||
case 'M':
|
||||
size *= ((unsigned long) 1024*1024);
|
||||
size *= 1024ULL * 1024ULL;
|
||||
break;
|
||||
case 'g':
|
||||
case 'G':
|
||||
size *= ((unsigned long) 1024*1024*1024);
|
||||
size *= 1024ULL * 1024ULL * 1024ULL;
|
||||
break;
|
||||
case '\0':
|
||||
break;
|
||||
|
||||
Reference in new issue
Block a user