| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: pass1.c,v 1.45 2008/10/09 15:50:46 christos Exp $ */ | | 1 | /* $NetBSD: pass1.c,v 1.46 2008/10/12 23:26:12 christos Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 1980, 1986, 1993 | | 4 | * Copyright (c) 1980, 1986, 1993 |
5 | * The Regents of the University of California. All rights reserved. | | 5 | * The Regents of the University of California. All rights reserved. |
6 | * | | 6 | * |
7 | * Redistribution and use in source and binary forms, with or without | | 7 | * Redistribution and use in source and binary forms, with or without |
8 | * modification, are permitted provided that the following conditions | | 8 | * modification, are permitted provided that the following conditions |
9 | * are met: | | 9 | * are met: |
10 | * 1. Redistributions of source code must retain the above copyright | | 10 | * 1. Redistributions of source code must retain the above copyright |
11 | * notice, this list of conditions and the following disclaimer. | | 11 | * notice, this list of conditions and the following disclaimer. |
12 | * 2. Redistributions in binary form must reproduce the above copyright | | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in the | | 13 | * notice, this list of conditions and the following disclaimer in the |
14 | * documentation and/or other materials provided with the distribution. | | 14 | * documentation and/or other materials provided with the distribution. |
| @@ -24,27 +24,27 @@ | | | @@ -24,27 +24,27 @@ |
24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | | 24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
25 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 25 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | | 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
29 | * SUCH DAMAGE. | | 29 | * SUCH DAMAGE. |
30 | */ | | 30 | */ |
31 | | | 31 | |
32 | #include <sys/cdefs.h> | | 32 | #include <sys/cdefs.h> |
33 | #ifndef lint | | 33 | #ifndef lint |
34 | #if 0 | | 34 | #if 0 |
35 | static char sccsid[] = "@(#)pass1.c 8.6 (Berkeley) 4/28/95"; | | 35 | static char sccsid[] = "@(#)pass1.c 8.6 (Berkeley) 4/28/95"; |
36 | #else | | 36 | #else |
37 | __RCSID("$NetBSD: pass1.c,v 1.45 2008/10/09 15:50:46 christos Exp $"); | | 37 | __RCSID("$NetBSD: pass1.c,v 1.46 2008/10/12 23:26:12 christos Exp $"); |
38 | #endif | | 38 | #endif |
39 | #endif /* not lint */ | | 39 | #endif /* not lint */ |
40 | | | 40 | |
41 | #include <sys/param.h> | | 41 | #include <sys/param.h> |
42 | #include <sys/stat.h> | | 42 | #include <sys/stat.h> |
43 | #include <sys/time.h> | | 43 | #include <sys/time.h> |
44 | | | 44 | |
45 | #include <ufs/ufs/dinode.h> | | 45 | #include <ufs/ufs/dinode.h> |
46 | #include <ufs/ufs/dir.h> | | 46 | #include <ufs/ufs/dir.h> |
47 | #include <ufs/ffs/fs.h> | | 47 | #include <ufs/ffs/fs.h> |
48 | #include <ufs/ufs/ufs_bswap.h> | | 48 | #include <ufs/ufs/ufs_bswap.h> |
49 | #include <ufs/ffs/ffs_extern.h> | | 49 | #include <ufs/ffs/ffs_extern.h> |
50 | | | 50 | |
| @@ -193,27 +193,27 @@ pass1(void) | | | @@ -193,27 +193,27 @@ pass1(void) |
193 | if (ninosused == 0) { | | 193 | if (ninosused == 0) { |
194 | free(inostathead[c].il_stat); | | 194 | free(inostathead[c].il_stat); |
195 | inostathead[c].il_stat = 0; | | 195 | inostathead[c].il_stat = 0; |
196 | continue; | | 196 | continue; |
197 | } | | 197 | } |
198 | if (ninosused != inosused) { | | 198 | if (ninosused != inosused) { |
199 | struct inostat *ninfo; | | 199 | struct inostat *ninfo; |
200 | size_t ninospace = ninosused * sizeof(*ninfo); | | 200 | size_t ninospace = ninosused * sizeof(*ninfo); |
201 | if (ninospace / sizeof(*info) != ninosused) { | | 201 | if (ninospace / sizeof(*info) != ninosused) { |
202 | pfatal("too many inodes %llu\n", | | 202 | pfatal("too many inodes %llu\n", |
203 | (unsigned long long)ninosused); | | 203 | (unsigned long long)ninosused); |
204 | exit(FSCK_EXIT_CHECK_FAILED); | | 204 | exit(FSCK_EXIT_CHECK_FAILED); |
205 | } | | 205 | } |
206 | ninfo = realloc(info, ninosused); | | 206 | ninfo = realloc(info, ninospace); |
207 | if (ninfo == NULL) { | | 207 | if (ninfo == NULL) { |
208 | pfatal("cannot realloc %zu bytes to %zu " | | 208 | pfatal("cannot realloc %zu bytes to %zu " |
209 | "for inoinfo\n", inospace, ninospace); | | 209 | "for inoinfo\n", inospace, ninospace); |
210 | exit(FSCK_EXIT_CHECK_FAILED); | | 210 | exit(FSCK_EXIT_CHECK_FAILED); |
211 | } | | 211 | } |
212 | if (ninosused > inosused) | | 212 | if (ninosused > inosused) |
213 | (void)memset(&ninfo[inosused], 0, ninospace - inospace); | | 213 | (void)memset(&ninfo[inosused], 0, ninospace - inospace); |
214 | inostathead[c].il_stat = ninfo; | | 214 | inostathead[c].il_stat = ninfo; |
215 | } | | 215 | } |
216 | } | | 216 | } |
217 | #ifdef PROGRESS | | 217 | #ifdef PROGRESS |
218 | if (!preen) | | 218 | if (!preen) |
219 | progress_done(); | | 219 | progress_done(); |