Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sbin/fsck_msdos Fix writing of corrected fsinfo.



details:   https://anonhg.NetBSD.org/src/rev/66235c81ab0a
branches:  trunk
changeset: 369696:66235c81ab0a
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Sun Aug 28 10:20:25 2022 +0000

description:
Fix writing of corrected fsinfo.
Continue when fsinfo has been rewritten.

diffstat:

 sbin/fsck_msdos/boot.c  |  8 ++++----
 sbin/fsck_msdos/check.c |  7 ++++---
 2 files changed, 8 insertions(+), 7 deletions(-)

diffs (60 lines):

diff -r 619e9d530f22 -r 66235c81ab0a sbin/fsck_msdos/boot.c
--- a/sbin/fsck_msdos/boot.c    Sun Aug 28 09:52:43 2022 +0000
+++ b/sbin/fsck_msdos/boot.c    Sun Aug 28 10:20:25 2022 +0000
@@ -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 @@
                    || 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 @@
                                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);
diff -r 619e9d530f22 -r 66235c81ab0a sbin/fsck_msdos/check.c
--- a/sbin/fsck_msdos/check.c   Sun Aug 28 09:52:43 2022 +0000
+++ b/sbin/fsck_msdos/check.c   Sun Aug 28 10:20:25 2022 +0000
@@ -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 @@
                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;



Home | Main Index | Thread Index | Old Index