dir-iterator: drop unused DIR_ITERATOR_FOLLOW_SYMLINKS
The `FOLLOW_SYMLINKS` flag was added to the dir-iterator API infa1da7d2ee(dir-iterator: add flags parameter to dir_iterator_begin, 2019-07-10) in order to follow symbolic links while traversing through a directory. `FOLLOW_SYMLINKS` gained its first caller inff7ccc8c9a(clone: use dir-iterator to avoid explicit dir traversal, 2019-07-10), but it was subsequently removed in6f054f9fb3(builtin/clone.c: disallow `--local` clones with symlinks, 2022-07-28). Since then, we've held on to the code for `DIR_ITERATOR_FOLLOW_SYMLINKS` in the name of making minimally invasive changes during a security embargo. In fact, we even changed the dir-iterator API inbffc762f87(dir-iterator: prevent top-level symlinks without FOLLOW_SYMLINKS, 2023-01-24) without having any non-test callers of that flag. Now that we're past those security embargo(s), let's finalize our cleanup of the `DIR_ITERATOR_FOLLOW_SYMLINKS` code and remove its implementation since there are no remaining callers. Signed-off-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
d9d677b2d8
commit
e00e56a7df
@ -112,10 +112,7 @@ static int prepare_next_entry_data(struct dir_iterator_int *iter,
|
||||
iter->base.basename = iter->base.path.buf +
|
||||
iter->levels[iter->levels_nr - 1].prefix_len;
|
||||
|
||||
if (iter->flags & DIR_ITERATOR_FOLLOW_SYMLINKS)
|
||||
err = stat(iter->base.path.buf, &iter->base.st);
|
||||
else
|
||||
err = lstat(iter->base.path.buf, &iter->base.st);
|
||||
err = lstat(iter->base.path.buf, &iter->base.st);
|
||||
|
||||
saved_errno = errno;
|
||||
if (err && errno != ENOENT)
|
||||
@ -213,13 +210,10 @@ struct dir_iterator *dir_iterator_begin(const char *path, unsigned int flags)
|
||||
iter->flags = flags;
|
||||
|
||||
/*
|
||||
* Note: stat/lstat already checks for NULL or empty strings and
|
||||
* Note: lstat already checks for NULL or empty strings and
|
||||
* nonexistent paths.
|
||||
*/
|
||||
if (iter->flags & DIR_ITERATOR_FOLLOW_SYMLINKS)
|
||||
err = stat(iter->base.path.buf, &iter->base.st);
|
||||
else
|
||||
err = lstat(iter->base.path.buf, &iter->base.st);
|
||||
err = lstat(iter->base.path.buf, &iter->base.st);
|
||||
|
||||
if (err < 0) {
|
||||
saved_errno = errno;
|
||||
|
||||
Reference in New Issue
Block a user