summaryrefslogtreecommitdiff
path: root/sysutils/fatback/patches/patch-ab
blob: 8ba3b174d5f3a1f7baaefefaafa785ad99380c8c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
$NetBSD: patch-ab,v 1.1.1.1 2005/05/25 10:29:01 agc Exp $

--- recovery.c	2005/05/25 10:11:56	1.1
+++ recovery.c	2005/05/25 10:13:54
@@ -85,10 +85,18 @@
            fname);
 
      chainlen = chain_length(clusts, cluster);
+#if 0
      reqd_clusts = size / bytes_per_clust;
      reqd_clusts += !!(size % bytes_per_clust);
+#else
+	/* this doesn't assume !! returns 0 or 1 */
+	reqd_clusts = (size + bytes_per_clust - 1) / bytes_per_clust;
+#endif
      if (chainlen < reqd_clusts) {
           display(VERBOSE, log_carve, fname);
+	  display(VERBOSE, "Need: %d got: %d Missing: %d bytes\n",
+		size, chainlen * bytes_per_clust,
+		size - (chainlen * bytes_per_clust));
           carve_file(clusts, cluster, size, bytes_per_clust, file);
           return 0;
      }