Deleted Added
full compact
dir.c (102231) dir.c (114589)
1/*
2 * Copyright (c) 1980, 1986, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 17 unchanged lines hidden (view full) ---

26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 */
33
1/*
2 * Copyright (c) 1980, 1986, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 17 unchanged lines hidden (view full) ---

26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 */
33
34#ifndef lint
35#if 0
34#if 0
35#ifndef lint
36static const char sccsid[] = "@(#)dir.c 8.8 (Berkeley) 4/28/95";
36static const char sccsid[] = "@(#)dir.c 8.8 (Berkeley) 4/28/95";
37#endif
38static const char rcsid[] =
39 "$FreeBSD: head/sbin/fsck_ffs/dir.c 102231 2002-08-21 18:11:48Z trhodes $";
40#endif /* not lint */
37#endif /* not lint */
38#endif
39#include <sys/cdefs.h>
40__FBSDID("$FreeBSD: head/sbin/fsck_ffs/dir.c 114589 2003-05-03 18:41:59Z obrien $");
41
42#include <sys/param.h>
43#include <sys/time.h>
44#include <sys/sysctl.h>
45
46#include <ufs/ufs/dinode.h>
47#include <ufs/ufs/dir.h>
48#include <ufs/ffs/fs.h>

--- 157 unchanged lines hidden (view full) ---

206
207/*
208 * Verify that a directory entry is valid.
209 * This is a superset of the checks made in the kernel.
210 */
211static int
212dircheck(struct inodesc *idesc, struct direct *dp)
213{
41
42#include <sys/param.h>
43#include <sys/time.h>
44#include <sys/sysctl.h>
45
46#include <ufs/ufs/dinode.h>
47#include <ufs/ufs/dir.h>
48#include <ufs/ffs/fs.h>

--- 157 unchanged lines hidden (view full) ---

206
207/*
208 * Verify that a directory entry is valid.
209 * This is a superset of the checks made in the kernel.
210 */
211static int
212dircheck(struct inodesc *idesc, struct direct *dp)
213{
214 int size;
214 size_t size;
215 char *cp;
215 char *cp;
216 u_char namlen, type;
216 u_char type;
217 u_int namlen;
217 int spaceleft;
218
219 spaceleft = DIRBLKSIZ - (idesc->id_loc % DIRBLKSIZ);
220 if (dp->d_reclen == 0 ||
221 dp->d_reclen > spaceleft ||
222 (dp->d_reclen & 0x3) != 0)
223 goto bad;
224 if (dp->d_ino == 0)

--- 493 unchanged lines hidden ---
218 int spaceleft;
219
220 spaceleft = DIRBLKSIZ - (idesc->id_loc % DIRBLKSIZ);
221 if (dp->d_reclen == 0 ||
222 dp->d_reclen > spaceleft ||
223 (dp->d_reclen & 0x3) != 0)
224 goto bad;
225 if (dp->d_ino == 0)

--- 493 unchanged lines hidden ---