Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sbin/fsck_msdos From: http://marc.info/?t=140304310700005&r=...
details: https://anonhg.NetBSD.org/src/rev/27344e5a3569
branches: trunk
changeset: 330401:27344e5a3569
user: christos <christos%NetBSD.org@localhost>
date: Mon Jul 07 17:45:42 2014 +0000
description:
From: http://marc.info/?t=140304310700005&r=1&w=2
When truncating cluster chains fix the length of the cluster head.
diffstat:
sbin/fsck_msdos/dir.c | 10 ++++++----
sbin/fsck_msdos/fat.c | 12 ++++++++++--
2 files changed, 16 insertions(+), 6 deletions(-)
diffs (69 lines):
diff -r 08b878fb4b14 -r 27344e5a3569 sbin/fsck_msdos/dir.c
--- a/sbin/fsck_msdos/dir.c Mon Jul 07 17:13:56 2014 +0000
+++ b/sbin/fsck_msdos/dir.c Mon Jul 07 17:45:42 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dir.c,v 1.25 2011/02/20 21:42:50 christos Exp $ */
+/* $NetBSD: dir.c,v 1.26 2014/07/07 17:45:42 christos Exp $ */
/*
* Copyright (C) 1995, 1996, 1997 Wolfgang Solfrank
@@ -30,7 +30,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: dir.c,v 1.25 2011/02/20 21:42:50 christos Exp $");
+__RCSID("$NetBSD: dir.c,v 1.26 2014/07/07 17:45:42 christos Exp $");
#endif /* not lint */
#include <stdio.h>
@@ -420,12 +420,14 @@
fullpath(dir));
if (ask(1, "Drop superfluous clusters")) {
cl_t cl;
- u_int32_t sz = 0;
+ u_int32_t sz, len;
- for (cl = dir->head; (sz += boot->ClusterSize) < dir->size;)
+ for (cl = dir->head, len = sz = 0;
+ (sz += boot->ClusterSize) < dir->size; len++)
cl = fat[cl].next;
clearchain(boot, fat, fat[cl].next);
fat[cl].next = CLUST_EOF;
+ fat[dir->head].length = len;
return FSFATMOD;
} else
return FSERROR;
diff -r 08b878fb4b14 -r 27344e5a3569 sbin/fsck_msdos/fat.c
--- a/sbin/fsck_msdos/fat.c Mon Jul 07 17:13:56 2014 +0000
+++ b/sbin/fsck_msdos/fat.c Mon Jul 07 17:45:42 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fat.c,v 1.24 2013/01/17 16:45:48 jakllsch Exp $ */
+/* $NetBSD: fat.c,v 1.25 2014/07/07 17:45:42 christos Exp $ */
/*
* Copyright (C) 1995, 1996, 1997 Wolfgang Solfrank
@@ -28,7 +28,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: fat.c,v 1.24 2013/01/17 16:45:48 jakllsch Exp $");
+__RCSID("$NetBSD: fat.c,v 1.25 2014/07/07 17:45:42 christos Exp $");
#endif /* not lint */
#include <stdlib.h>
@@ -355,7 +355,15 @@
clearchain(boot, fat, head);
return FSFATMOD;
} else if (ask(0, "Truncate")) {
+ uint32_t len;
+ cl_t p;
+
+ for (p = head, len = 0;
+ p >= CLUST_FIRST && p < boot->NumClusters;
+ p = fat[p].next, len++)
+ continue;
*truncp = CLUST_EOF;
+ fat[head].length = len;
return FSFATMOD;
} else
return FSERROR;
Home |
Main Index |
Thread Index |
Old Index