Module Name: src
Committed By: jakllsch
Date: Mon Nov 3 18:55:04 UTC 2014
Modified Files:
src/sbin/fsck_msdos: boot.c dosfs.h
Log Message:
ClusterOffset actually needs to be able to be negative.
To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sbin/fsck_msdos/boot.c
cvs rdiff -u -r1.6 -r1.7 src/sbin/fsck_msdos/dosfs.h
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.16 src/sbin/fsck_msdos/boot.c:1.17
--- src/sbin/fsck_msdos/boot.c:1.16 Mon Jul 7 19:04:37 2014
+++ src/sbin/fsck_msdos/boot.c Mon Nov 3 18:55:04 2014
@@ -27,7 +27,7 @@
#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.17 2014/11/03 18:55:04 jakllsch Exp $");
#endif /* not lint */
#include <stdlib.h>
@@ -184,7 +184,7 @@ readboot(int dosfs, struct bootblock *bo
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 +205,8 @@ readboot(int dosfs, struct bootblock *bo
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;
}
Index: src/sbin/fsck_msdos/dosfs.h
diff -u src/sbin/fsck_msdos/dosfs.h:1.6 src/sbin/fsck_msdos/dosfs.h:1.7
--- src/sbin/fsck_msdos/dosfs.h:1.6 Fri Jun 13 20:46:09 2008
+++ src/sbin/fsck_msdos/dosfs.h Mon Nov 3 18:55:04 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: dosfs.h,v 1.6 2008/06/13 20:46:09 martin Exp $ */
+/* $NetBSD: dosfs.h,v 1.7 2014/11/03 18:55:04 jakllsch Exp $ */
/*
* Copyright (C) 1995, 1996, 1997 Wolfgang Solfrank
@@ -70,7 +70,7 @@ struct bootblock {
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: */