History log of /haiku/src/libs/bsd/fts.c
Revision Date Author Comments
# 24a34a5e 28-Jul-2023 Adrien Destugues <adrien.destugues@opensource.viveris.fr>

fts: fix unused-but-set variable

This warning happens on Haiku because we don't have DT_DIR and the
dt_type field in dirent. The FreeBSD code has a partial ifdef for that,
but it is missing in some places, leading to an unused but set variable.

Completely disable the variable when DT_DIR is missing.

Change-Id: I274799b0d25e2df27758fcf4452567879aed8e10
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6764
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# 4c47466f 28-Jul-2023 Augustin Cavalier <waddlesplash@gmail.com>

fts: Roll up changes from FreeBSD.

Notable changes include:

* fts: Stat things relative to the directory fd, if possible.
* fts: Fix double-free with conflicting concurrent modifications.
* fts: Don't abort if an empty pathname is given.
* fts: Don't return FTS_SLNONE if it's not a symlink (if race).
* fts_children: preserve errno after running close/fchdir
* Use ANSI C prototypes. Eliminates -Wold-style-definition warnings.
* fts: Fix a potential memory leak in error case
* libc: Check for readdir(2) errors in fts(3)


# b9a6a85b 24-Jun-2023 Niels Sascha Reedijk <niels.reedijk@gmail.com>

libbsd: rewrite fts.c to avoid error

With GCC13 the current code and its use of the `realloc` function triggers a
potential use after free warning. The code is most likely correct, but there
may be a bug in GCC13's use after free checking, or this is one of the cases
where it is not possible to accurately detect if there is really a chance that
it is used after free.

This rewrites the code in such a way that the warning is no longer triggered.

No functional change intended.

Change-Id: I85e145de2128d4b12a9b3016de33d9facaf0d758
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6648
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Reviewed-by: Axel Dörfler <axeld@pinc-software.de>


# 0afb8a1b 09-Jun-2022 Augustin Cavalier <waddlesplash@gmail.com>

Move fts.h and functions from libroot to libbsd.

These are BSD extensions, not POSIX functions. They were needed
in libroot by the previous versions of the ftw/nftw implementations,
but the musl versions do not need them, and so we can move them to
libbsd.

This is a minor ABI break, but hopefully whatever was using them
in libroot also links to libbsd. If not, that's an easy enough fix.
(These were only added to libroot in 2013.)