Source-Changes-HG archive

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

[src/netbsd-7]: src/sbin/fsck_msdos Pull up following revision(s) (requested ...



details:   https://anonhg.NetBSD.org/src/rev/aaee73f9d5ab
branches:  netbsd-7
changeset: 798580:aaee73f9d5ab
user:      martin <martin%NetBSD.org@localhost>
date:      Fri Nov 14 15:49:16 2014 +0000

description:
Pull up following revision(s) (requested by jakllsch in ticket #234):
        sbin/fsck_msdos/boot.c: revision 1.18
        sbin/fsck_msdos/dosfs.h: revision 1.7
        sbin/fsck_msdos/boot.c: revision 1.17
ClusterOffset actually needs to be able to be negative.
 Add #include <inttypes.h> for intmax_t to fix compile error.

diffstat:

 sbin/fsck_msdos/boot.c  |  9 +++++----
 sbin/fsck_msdos/dosfs.h |  4 ++--
 2 files changed, 7 insertions(+), 6 deletions(-)

diffs (56 lines):

diff -r 41d01e85cf79 -r aaee73f9d5ab sbin/fsck_msdos/boot.c
--- a/sbin/fsck_msdos/boot.c    Fri Nov 14 15:22:40 2014 +0000
+++ b/sbin/fsck_msdos/boot.c    Fri Nov 14 15:49:16 2014 +0000
@@ -27,12 +27,13 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: boot.c,v 1.16 2014/07/07 19:04:37 christos Exp $");
+__RCSID("$NetBSD: boot.c,v 1.16.2.1 2014/11/14 15:49:16 martin Exp $");
 #endif /* not lint */
 
 #include <stdlib.h>
 #include <string.h>
 #include <strings.h>
+#include <inttypes.h>
 #include <stdio.h>
 #include <unistd.h>
 
@@ -184,7 +185,7 @@
                return FSFATAL;
        }
 
-       boot->ClusterOffset = (boot->RootDirEnts * 32 + boot->BytesPerSec - 1)
+       boot->ClusterOffset = (int)(boot->RootDirEnts * 32 + boot->BytesPerSec - 1)
            / boot->BytesPerSec
            + boot->ResSectors
            + boot->FATs * boot->FATsecs
@@ -205,8 +206,8 @@
                boot->NumSectors = boot->HugeSectors;
        boot->NumClusters = (boot->NumSectors - boot->ClusterOffset) / boot->SecPerClust;
 
-       if (boot->ClusterOffset > boot->NumSectors) {
-               pfatal("Cluster offset too large (%u clusters)\n",
+       if (boot->ClusterOffset > (intmax_t)boot->NumSectors) {
+               pfatal("Cluster offset too large (%d sectors)\n",
                    boot->ClusterOffset);
                return FSFATAL;
        }
diff -r 41d01e85cf79 -r aaee73f9d5ab sbin/fsck_msdos/dosfs.h
--- a/sbin/fsck_msdos/dosfs.h   Fri Nov 14 15:22:40 2014 +0000
+++ b/sbin/fsck_msdos/dosfs.h   Fri Nov 14 15:49:16 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dosfs.h,v 1.6 2008/06/13 20:46:09 martin Exp $ */
+/*     $NetBSD: dosfs.h,v 1.6.38.1 2014/11/14 15:49:16 martin Exp $    */
 
 /*
  * Copyright (C) 1995, 1996, 1997 Wolfgang Solfrank
@@ -70,7 +70,7 @@
        u_int32_t NumSectors;           /* how many sectors are there */
        u_int32_t FATsecs;              /* how many sectors are in FAT */
        u_int32_t NumFatEntries;        /* how many entries really are there */
-       u_int   ClusterOffset;          /* at what sector would sector 0 start */
+       int     ClusterOffset;          /* at what sector would sector 0 start */
        u_int   ClusterSize;            /* Cluster size in bytes */
 
        /* Now some statistics: */



Home | Main Index | Thread Index | Old Index