mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-11-25 01:55:19 +01:00
Change secrorsize back to int, since that's the data type expected by the
ioctl(DIOCGSECTORSIZE). It creates issues on some architectures. MFC after: 1 week Reported by: Jayachandran C.
This commit is contained in:
parent
1d0e1dac57
commit
eb8d193be2
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=204909
@ -92,7 +92,7 @@ int Jflag; /* enable gjournal for file system */
|
||||
int lflag; /* enable multilabel for file system */
|
||||
int nflag; /* do not create .snap directory */
|
||||
intmax_t fssize; /* file system size */
|
||||
int64_t sectorsize; /* bytes/sector */
|
||||
int sectorsize; /* bytes/sector */
|
||||
int realsectorsize; /* bytes/sector in hardware */
|
||||
int64_t fsize = 0; /* fragment size */
|
||||
int64_t bsize = 0; /* block size */
|
||||
@ -119,6 +119,7 @@ static void getfssize(intmax_t *, const char *p, intmax_t, intmax_t);
|
||||
static struct disklabel *getdisklabel(char *s);
|
||||
static void rewritelabel(char *s, struct disklabel *lp);
|
||||
static void usage(void);
|
||||
static int expand_number_int(const char *buf, int *num);
|
||||
|
||||
ufs2_daddr_t part_ofs; /* partition offset in blocks, used with files */
|
||||
|
||||
@ -171,7 +172,7 @@ main(int argc, char *argv[])
|
||||
Rflag = 1;
|
||||
break;
|
||||
case 'S':
|
||||
rval = expand_number(optarg, §orsize);
|
||||
rval = expand_number_int(optarg, §orsize);
|
||||
if (rval < 0 || sectorsize <= 0)
|
||||
errx(1, "%s: bad sector size", optarg);
|
||||
break;
|
||||
@ -496,3 +497,20 @@ usage()
|
||||
fprintf(stderr, "\t-s file system size (sectors)\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
static int
|
||||
expand_number_int(const char *buf, int *num)
|
||||
{
|
||||
int64_t num64;
|
||||
int rval;
|
||||
|
||||
rval = expand_number(buf, &num64);
|
||||
if (rval != 0)
|
||||
return (rval);
|
||||
if (num64 > INT_MAX) {
|
||||
errno = ERANGE;
|
||||
return (-1);
|
||||
}
|
||||
*num = (int)num64;
|
||||
return (0);
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ extern int Jflag; /* enable gjournal for file system */
|
||||
extern int lflag; /* enable multilabel MAC for file system */
|
||||
extern int nflag; /* do not create .snap directory */
|
||||
extern intmax_t fssize; /* file system size */
|
||||
extern int64_t sectorsize; /* bytes/sector */
|
||||
extern int sectorsize; /* bytes/sector */
|
||||
extern int realsectorsize; /* bytes/sector in hardware*/
|
||||
extern int64_t fsize; /* fragment size */
|
||||
extern int64_t bsize; /* block size */
|
||||
|
Loading…
Reference in New Issue
Block a user