Age | Commit message (Collapse) | Author |
|
|
|
|
|
(fts_open): Don't cast a function value in a possibly-unsafe way.
(fts_compar): New function.
(fts_sort): Use it.
|
|
(fts_safe_changedir): Use fd_safer.
|
|
Mark parameter `sp' with ATTRIBUTE_UNUSED.
|
|
(TYPE_SIGNED): Remove.
|
|
to a failed fchdir or failed fts_safe_changedir call, set
`sp->fts_cur = p'. Do this by removing the explicit `return NULL;'
statements and setting p->fts_errno so execution falls through
to the common-case code below. Otherwise, after such a failure,
calling fts_close would attempt to free an already-freed buffer.
Reported by Luis Lopez Lopez in http://bugs.debian.org/276352.
|
|
rather than the unportable "u_short", and similarly for u_int.
|
|
|
|
(fts_open, fts_read, fts_children, fts_safe_changedir):
Use it, so that the code works even if the directory
is writeable but not readable.
|
|
(PRIuMAX) [!PRI_MACROS_BROKEN && !defined PRIuMAX]: New macro.
(find_matching_ancestor): Use it for dev_t and ino_t.
|
|
Include stdint.h if available, as Autoconf suggests.
(ALIGNBYTES, ALIGN): Remove; no longer needed now that fts_statp
is an array.
(fts_alloc, fts_palloc, fts_sort, fts_load, fts_build):
Use size_t for sizes.
(fts_stat, fts_safe_changedir, fts_debug, fts_read, fts_build,
fts_palloc):
Use bool when appropriate.
(SIZE_MAX, TYPE_SIGNED): New macros.
(fts_read): Use u_short for instructions.
(fts_build): Use ptrdiff_t for levels. Don't assume file name lengths
fit into int. Don't assume nlink_t is signed.
(find_matching_ancestor): Don't assume dev, ino fit in int.
(fts_stat): Use function prototype; required for bool arg.
(fts_sort): Detect integer overflow in size calculations.
(fts_alloc): Simplify allocation code, now that fts_statp is an array
and not a pointer.
|
|
stat, even if the user isn't interested in the results.
This prevents a core dump in cycle_check when FTS_NOSTAT is set.
|
|
|
|
|
|
|
|
[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.
|
|
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.
|
|
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.
|
|
each sequence of spaces before a TAB character.
|
|
member to NULL before returning. From NetBSD.
|
|
before returning. From NetBSD.
|
|
(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.
|
|
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.
|
|
(fts_read): If fts_safe_changedir fails because it is not
able to chdir into a subdirectory, then inform the caller.
|
|
|
|
|