From f7984144d514d5ddb96bd16b59ae5bb4a2b7679a Mon Sep 17 00:00:00 2001 From: Ben Gras Date: Fri, 22 Dec 2006 13:40:37 +0000 Subject: [PATCH] . fsck needs more memory . fsck must deal with s_max_file_size in superblock being larger than LONG_MAX now that off_t is signed --- commands/simple/Makefile | 2 +- commands/simple/fsck.c | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/commands/simple/Makefile b/commands/simple/Makefile index b7ae3806c..2ab7702b9 100755 --- a/commands/simple/Makefile +++ b/commands/simple/Makefile @@ -419,7 +419,7 @@ fortune: fortune.c fsck: fsck.c $(CCLD) -o $@ $? - @install -S 4096k $@ + @install -S 5120k $@ fsck1: fsck1.c $(CCLD) -o $@ $? diff --git a/commands/simple/fsck.c b/commands/simple/fsck.c index 5135de513..14cadc6bd 100755 --- a/commands/simple/fsck.c +++ b/commands/simple/fsck.c @@ -573,8 +573,11 @@ void getsuper() if (sb.s_zmap_blocks <= 0) fatal("no zmap"); if (sb.s_firstdatazone <= 4) fatal("first data zone too small"); if (sb.s_log_zone_size < 0) fatal("zone size < block size"); - if (sb.s_max_size <= 0) fatal("max. file size <= 0"); - + if (sb.s_max_size <= 0) { + printf("max file size %ld ", sb.s_max_size); + sb.s_max_size = LONG_MAX; + printf("set to %ld\n", sb.s_max_size); + } } /* Check the super block for reasonable contents. */ @@ -616,6 +619,8 @@ void chksuper() maxsize = MAX_FILE_POS; if (((maxsize - 1) >> sb.s_log_zone_size) / block_size >= MAX_ZONES) maxsize = ((long) MAX_ZONES * block_size) << sb.s_log_zone_size; + if(maxsize <= 0) + maxsize = LONG_MAX; if (sb.s_max_size != maxsize) { printf("warning: expected max size to be %ld ", maxsize); printf("instead of %ld\n", sb.s_max_size); -- 2.44.0