Deleted Added
full compact
dir.c (50476) dir.c (62668)
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

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

31 * SUCH DAMAGE.
32 */
33
34#ifndef lint
35#if 0
36static const char sccsid[] = "@(#)dir.c 8.8 (Berkeley) 4/28/95";
37#endif
38static const char rcsid[] =
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

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

31 * SUCH DAMAGE.
32 */
33
34#ifndef lint
35#if 0
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 50476 1999-08-28 00:22:10Z peter $";
39 "$FreeBSD: head/sbin/fsck_ffs/dir.c 62668 2000-07-06 02:03:11Z mckusick $";
40#endif /* not lint */
41
42#include <sys/param.h>
43#include <sys/time.h>
44
45#include <ufs/ufs/dinode.h>
46#include <ufs/ufs/dir.h>
47#include <ufs/ffs/fs.h>

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

236 register char *cp;
237 u_char namlen, type;
238 int spaceleft;
239
240 spaceleft = DIRBLKSIZ - (idesc->id_loc % DIRBLKSIZ);
241 if (dp->d_reclen == 0 ||
242 dp->d_reclen > spaceleft ||
243 (dp->d_reclen & 0x3) != 0)
40#endif /* not lint */
41
42#include <sys/param.h>
43#include <sys/time.h>
44
45#include <ufs/ufs/dinode.h>
46#include <ufs/ufs/dir.h>
47#include <ufs/ffs/fs.h>

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

236 register char *cp;
237 u_char namlen, type;
238 int spaceleft;
239
240 spaceleft = DIRBLKSIZ - (idesc->id_loc % DIRBLKSIZ);
241 if (dp->d_reclen == 0 ||
242 dp->d_reclen > spaceleft ||
243 (dp->d_reclen & 0x3) != 0)
244 return (0);
244 goto bad;
245 if (dp->d_ino == 0)
246 return (1);
247 size = DIRSIZ(!newinofmt, dp);
248# if (BYTE_ORDER == LITTLE_ENDIAN)
249 if (!newinofmt) {
250 type = dp->d_namlen;
251 namlen = dp->d_type;
252 } else {
253 namlen = dp->d_namlen;
254 type = dp->d_type;
255 }
256# else
257 namlen = dp->d_namlen;
258 type = dp->d_type;
259# endif
260 if (dp->d_reclen < size ||
261 idesc->id_filesize < size ||
262 namlen > MAXNAMLEN ||
263 type > 15)
245 if (dp->d_ino == 0)
246 return (1);
247 size = DIRSIZ(!newinofmt, dp);
248# if (BYTE_ORDER == LITTLE_ENDIAN)
249 if (!newinofmt) {
250 type = dp->d_namlen;
251 namlen = dp->d_type;
252 } else {
253 namlen = dp->d_namlen;
254 type = dp->d_type;
255 }
256# else
257 namlen = dp->d_namlen;
258 type = dp->d_type;
259# endif
260 if (dp->d_reclen < size ||
261 idesc->id_filesize < size ||
262 namlen > MAXNAMLEN ||
263 type > 15)
264 return (0);
264 goto bad;
265 for (cp = dp->d_name, size = 0; size < namlen; size++)
266 if (*cp == '\0' || (*cp++ == '/'))
265 for (cp = dp->d_name, size = 0; size < namlen; size++)
266 if (*cp == '\0' || (*cp++ == '/'))
267 return (0);
267 goto bad;
268 if (*cp != '\0')
268 if (*cp != '\0')
269 return (0);
269 goto bad;
270 return (1);
270 return (1);
271bad:
272 if (debug)
273 printf("Bad dir: ino %d reclen %d namlen %d type %d name %s\n",
274 dp->d_ino, dp->d_reclen, dp->d_namlen, dp->d_type,
275 dp->d_name);
276 return (0);
271}
272
273void
274direrror(ino, errmesg)
275 ino_t ino;
276 char *errmesg;
277{
278

--- 491 unchanged lines hidden ---
277}
278
279void
280direrror(ino, errmesg)
281 ino_t ino;
282 char *errmesg;
283{
284

--- 491 unchanged lines hidden ---