Large file systems with inodes > 512K have been silently overflowing
c_addr in spcl. So check before we start dumping otherwise we can end up with a corrupted dump. PR: 228807 Submitted by: db Reviewed by: imp Approved by: imp
This commit is contained in:
parent
73b1879c2d
commit
803fec5fdf
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=334968
@ -103,6 +103,7 @@ main(int argc, char *argv[])
|
|||||||
int i, ret, anydirskipped, bflag = 0, Tflag = 0, honorlevel = 1;
|
int i, ret, anydirskipped, bflag = 0, Tflag = 0, honorlevel = 1;
|
||||||
int just_estimate = 0;
|
int just_estimate = 0;
|
||||||
ino_t maxino;
|
ino_t maxino;
|
||||||
|
int c_count=0;
|
||||||
char *tmsg;
|
char *tmsg;
|
||||||
|
|
||||||
spcl.c_date = _time_to_time64(time(NULL));
|
spcl.c_date = _time_to_time64(time(NULL));
|
||||||
@ -433,7 +434,6 @@ main(int argc, char *argv[])
|
|||||||
msgtail("to %s\n", tape);
|
msgtail("to %s\n", tape);
|
||||||
|
|
||||||
sync();
|
sync();
|
||||||
sblock = NULL;
|
|
||||||
if ((ret = sbget(diskfd, &sblock, -1)) != 0) {
|
if ((ret = sbget(diskfd, &sblock, -1)) != 0) {
|
||||||
switch (ret) {
|
switch (ret) {
|
||||||
case ENOENT:
|
case ENOENT:
|
||||||
@ -453,6 +453,9 @@ main(int argc, char *argv[])
|
|||||||
quit("TP_BSIZE (%d) is not a power of 2", TP_BSIZE);
|
quit("TP_BSIZE (%d) is not a power of 2", TP_BSIZE);
|
||||||
maxino = sblock->fs_ipg * sblock->fs_ncg;
|
maxino = sblock->fs_ipg * sblock->fs_ncg;
|
||||||
mapsize = roundup(howmany(maxino, CHAR_BIT), TP_BSIZE);
|
mapsize = roundup(howmany(maxino, CHAR_BIT), TP_BSIZE);
|
||||||
|
c_count = howmany(mapsize * sizeof(char), TP_BSIZE);
|
||||||
|
if (c_count > TP_NINDIR)
|
||||||
|
quit("fs is too large for dump!");
|
||||||
usedinomap = (char *)calloc((unsigned) mapsize, sizeof(char));
|
usedinomap = (char *)calloc((unsigned) mapsize, sizeof(char));
|
||||||
dumpdirmap = (char *)calloc((unsigned) mapsize, sizeof(char));
|
dumpdirmap = (char *)calloc((unsigned) mapsize, sizeof(char));
|
||||||
dumpinomap = (char *)calloc((unsigned) mapsize, sizeof(char));
|
dumpinomap = (char *)calloc((unsigned) mapsize, sizeof(char));
|
||||||
|
Loading…
Reference in New Issue
Block a user