summaryrefslogtreecommitdiff
path: root/lib/fts.c
AgeCommit message (Collapse)Author
2004-06-08(fts_stat, fts_alloc): Always allocate and use a structJim Meyering
stat, even if the user isn't interested in the results. This prevents a core dump in cycle_check when FTS_NOSTAT is set.
2004-03-29Include dirfd.h, for dirfd.Jim Meyering
2003-12-20[!_LIBC]: Undefine, then define-away __P.Jim Meyering
2003-12-20[!_LIBC]: Define __P.Jim Meyering
2003-12-19Don't include <search.h>.Jim Meyering
[HAVE_INTTYPES_H]: Include <inttypes.h>. (tdestroy, tfind, tsearch): Remove definitions. (struct Active_dir): Rename from `known_object'. (AD_compare, AD_hash): New functions. (enter_dir, leave_dir): Rewrite to manipulate a hash table rather than a tree. (fts_open): Initialize hash table or cycle_state buffer. (free_node): Remove function. (find_matching_ancestor): Renamed/rewritten from look_up_active_dir. (fts_cross_check): Adapt to use new data structure.
2003-12-18Rewrite cycle detection code to work properly.Jim Meyering
Add some framework (compiled out by default) to test it. (Dprintf, ENTER_DIR, LEAVE_DIR): Define. (add_object): Remove function. Rewritten as... (enter_dir): New function. (leave_dir, free_node): New functions. (fts_read): Ensure that we call ENTER_DIR or LEAVE_DIR, as appropriate, before returning. (look_up_active_dir, fts_cross_check) [FTS_DEBUG]: New functions. (fts_stat): Don't perform the cycle check here. Now it's done via enter_dir.
2003-10-02Don't require that the maximum length of a file nameJim Meyering
encountered in a traversal fit in an `unsigned short', and fix some portability bugs (don't depend on gcc). Include "fts_.h", not <fts.h>. (ALIGNBYTES) [!(__GNUC__ >= 2)]: Add a definition that works with compilers that don't have __alignof__. (MAX): Use a definition that doesn't depend on gcc. (fts_build): Make `len' and `maxlen' be of type size_t, not int. Test for overflow in a less type-dependent manner. Test HAVE_STRUCT_DIRENT_D_TYPE, rather than defined DT_DIR && defined _DIRENT_HAVE_D_TYPE. (fts_palloc): Test for overflow in a less type-dependent manner. (fts_safe_changedir): Use stat, not stat64. Use fstat, not __fxstat64(_STAT_VER.
2003-04-15Remove (or replace-with-TAB(s) to retain alignment)Jim Meyering
each sequence of spaces before a TAB character.
2003-02-28(fts_children): If opening `.' fails, set the fts_childJim Meyering
member to NULL before returning. From NetBSD.
2003-02-28(fts_children): If fchdir fails, close file descriptorJim Meyering
before returning. From NetBSD.
2003-02-24Include <search.h>.Jim Meyering
(struct known_object): Define. (object_compare, add_object, find_object): New functions, like those in ftw.c. (fts_open): Initialize new member. (fts_close): Free memory allocated for new member. (fts_stat): Detect a cycle in O(logN) time per directory processed.
2003-02-24[HAVE_CONFIG_H]: Include <config.h>.Jim Meyering
Conditionalize inclusion of <sys/param.h>. Conditionalize inclusion of <include/sys/stat.h> vs <sys/stat.h>. Include autoconf-recommended block of dirent/NAMELEN-related definitions and includes. Use NAMLEN throughout, rather than _D_EXACT_NAMLEN. [_LIBC] (close, closedir, fchdir, open, opendir): Define. [_LIBC] (readdir, tdestroy, tfind, tsearch): Define. Remove `__' prefix from all uses of the above. This will help to merge *BSD changes. [!_LIBC] (internal_function): Define. [! _LIBC && ! LSTAT_FOLLOWS_SLASHED_SYMLINK]: Define lstat. (__set_errno): Define if not already defined.
2003-02-24(fts_open): If fts_alloc returns NULL, don't dereference it.Jim Meyering
(fts_read): If fts_safe_changedir fails because it is not able to chdir into a subdirectory, then inform the caller.
2003-02-24virgin copy from glibcJim Meyering
2003-02-13hacked from the versions in glibcJim Meyering