Browse Source

Don't stop traversing a directory hierarchy if we reach SHRT_MAX,

just stop updating fts_level so we don't overflow it.  This allows
rm, find, etc to operate on very deep hierarchies.  Consumers of
fts(3) do need to be aware that the actual level may be larger
than fts_level.  During the next libc major bump we will make
fts_level an int instead of a short.  OK deraadt@
OPENBSD_4_7
millert 15 years ago
parent
commit
ec2fdb5af0
1 changed files with 2 additions and 1 deletions
  1. +2
    -1
      src/include/fts.h

+ 2
- 1
src/include/fts.h View File

@ -1,4 +1,4 @@
/* $OpenBSD: fts.h,v 1.11 2005/06/17 20:36:55 millert Exp $ */
/* $OpenBSD: fts.h,v 1.12 2009/08/27 16:19:27 millert Exp $ */
/* $NetBSD: fts.h,v 1.5 1994/12/28 01:41:50 mycroft Exp $ */ /* $NetBSD: fts.h,v 1.5 1994/12/28 01:41:50 mycroft Exp $ */
/* /*
@ -79,6 +79,7 @@ typedef struct _ftsent {
#define FTS_ROOTPARENTLEVEL -1 #define FTS_ROOTPARENTLEVEL -1
#define FTS_ROOTLEVEL 0 #define FTS_ROOTLEVEL 0
#define FTS_MAXLEVEL 0x7fff
short fts_level; /* depth (-1 to N) */ short fts_level; /* depth (-1 to N) */
#define FTS_D 1 /* preorder directory */ #define FTS_D 1 /* preorder directory */


Loading…
Cancel
Save