From: Robert Pengelly Date: Sat, 30 Aug 2025 04:57:29 +0000 (+0100) Subject: Bug fixes X-Git-Url: https://git.candlhat.org/?a=commitdiff_plain;h=89bd593fa3dd4ef64a1eb374a0d099f188641452;p=minixfstools.git Bug fixes --- diff --git a/common.c b/common.c index 20a7a3e..6229a3d 100644 --- a/common.c +++ b/common.c @@ -255,10 +255,10 @@ void incr_size (FILE *fp, int n, unsigned long count) { off = (n - 1) % INODES_PER_BLOCK; - size = ((unsigned long) inode[off].i_size[0]) | (((unsigned long) inode[off].i_size[1]) << 8); + size = ((unsigned long) inode[off].i_size[0]) | (((unsigned long) inode[off].i_size[1]) << 8) | (((unsigned long) inode[off].i_size[2]) << 16) | (((unsigned long) inode[off].i_size[3]) << 24); size += count; - write_to_byte_array (inode[off].i_size, size, 2); + write_to_byte_array (inode[off].i_size, size, 4); put_block (fp, b, inode); } diff --git a/mcopy.c b/mcopy.c index 0fec895..e79ece7 100644 --- a/mcopy.c +++ b/mcopy.c @@ -466,7 +466,7 @@ static void copy_file (FILE *fp, unsigned long parent, char *fn) { ct = bytes; } - ino = alloc_inode (ofp, mode_con (mode), 2, 1); + ino = alloc_inode (ofp, mode_con (mode), 0, 0); enter_dir (ofp, parent, basename, ino); incr_size (ofp, parent, 16L); diff --git a/mkfs.c b/mkfs.c index 8613126..85e0a40 100644 --- a/mkfs.c +++ b/mkfs.c @@ -372,9 +372,10 @@ static void super (unsigned long zones, unsigned long inodes) { write_to_byte_array (sup->s_log_zone_size, zone_shift, 2); write_to_byte_array (sup->s_magic, SUPER_MAGIC, 2); - zo = 7L + NR_INDIRECTS + (NR_INDIRECTS * NR_INDIRECTS); - write_to_byte_array (sup->s_max_size, zo, 4); + zo = 7L + NR_INDIRECTS + (long) NR_INDIRECTS * NR_INDIRECTS; + write_to_byte_array (sup->s_max_size, zo * BLOCK_SIZE, 4); + write_to_byte_array (sup->s_state, 1, 2); seekto (ofp, 2); if (fwrite (buf, BLOCK_SIZE, 1, ofp) != 1) { @@ -599,7 +600,7 @@ int main (int argc, char **argv) { super (nzones, ninodes); - rootdir (alloc_inode (ofp, 040777, 2, 2)); + rootdir (alloc_inode (ofp, 040755, 2, 2)); return EXIT_SUCCESS; } diff --git a/mmd.c b/mmd.c index d3500e0..b38efb4 100644 --- a/mmd.c +++ b/mmd.c @@ -412,7 +412,7 @@ static void walk_dir (char *dirname) { } - ino = alloc_inode (ofp, mode_con ("d--755"), 2, 1); + ino = alloc_inode (ofp, mode_con ("d--755"), 0, 0); enter_dir (ofp, parent_ino, p1, ino); incr_size (ofp, parent_ino, 16L); diff --git a/super.h b/super.h index 1473278..d46c33d 100644 --- a/super.h +++ b/super.h @@ -17,6 +17,9 @@ struct super_block { unsigned char s_max_size[4]; unsigned char s_magic[2]; + + unsigned char s_state[2]; + unsigned char s_zones[4]; };