Module Name: src Committed By: mlelstv Date: Sun Aug 28 10:20:25 UTC 2022
Modified Files: src/sbin/fsck_msdos: boot.c check.c Log Message: Fix writing of corrected fsinfo. Continue when fsinfo has been rewritten. To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/sbin/fsck_msdos/boot.c cvs rdiff -u -r1.19 -r1.20 src/sbin/fsck_msdos/check.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sbin/fsck_msdos/boot.c diff -u src/sbin/fsck_msdos/boot.c:1.25 src/sbin/fsck_msdos/boot.c:1.26 --- src/sbin/fsck_msdos/boot.c:1.25 Sun Apr 24 10:35:15 2022 +++ src/sbin/fsck_msdos/boot.c Sun Aug 28 10:20:25 2022 @@ -27,7 +27,7 @@ #include <sys/cdefs.h> #ifndef lint -__RCSID("$NetBSD: boot.c,v 1.25 2022/04/24 10:35:15 hannken Exp $"); +__RCSID("$NetBSD: boot.c,v 1.26 2022/08/28 10:20:25 mlelstv Exp $"); #endif /* not lint */ #include <stdlib.h> @@ -147,7 +147,7 @@ readboot(int dosfs, struct bootblock *bo || fsinfo[0x3fd] || fsinfo[0x3fe] != 0x55 || fsinfo[0x3ff] != 0xaa) { - pwarn("Invalid signature in fsinfo block"); + pwarn("Invalid signature in fsinfo block\n"); if (ask(0, "fix")) { memcpy(fsinfo, "RRaA", 4); memcpy(fsinfo + 0x1e4, "rrAa", 4); @@ -159,8 +159,8 @@ readboot(int dosfs, struct bootblock *bo fsinfo[0x3ff] = 0xaa; if (lseek(dosfs, boot->FSInfo * boot->BytesPerSec, SEEK_SET) != boot->FSInfo * boot->BytesPerSec - || write(dosfs, fsinfo, sizeof fsinfo) - != sizeof fsinfo) { + || write(dosfs, fsinfo, 2 * secsize) + != 2 * secsize) { perr("Unable to write FSInfo"); free(fsinfo); free(backup); Index: src/sbin/fsck_msdos/check.c diff -u src/sbin/fsck_msdos/check.c:1.19 src/sbin/fsck_msdos/check.c:1.20 --- src/sbin/fsck_msdos/check.c:1.19 Thu Jul 10 21:06:20 2014 +++ src/sbin/fsck_msdos/check.c Sun Aug 28 10:20:25 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: check.c,v 1.19 2014/07/10 21:06:20 christos Exp $ */ +/* $NetBSD: check.c,v 1.20 2022/08/28 10:20:25 mlelstv Exp $ */ /* * Copyright (C) 1995, 1996, 1997 Wolfgang Solfrank @@ -28,7 +28,7 @@ #include <sys/cdefs.h> #ifndef lint -__RCSID("$NetBSD: check.c,v 1.19 2014/07/10 21:06:20 christos Exp $"); +__RCSID("$NetBSD: check.c,v 1.20 2022/08/28 10:20:25 mlelstv Exp $"); #endif /* not lint */ #include <stdlib.h> @@ -72,7 +72,8 @@ checkfilesys(const char *filename) return FSCK_EXIT_CHECK_FAILED; } - if (readboot(dosfs, &boot) != FSOK) { + mod = readboot(dosfs, &boot); + if (mod & FSFATAL) { close(dosfs); printf("\n"); return FSCK_EXIT_CHECK_FAILED;