summaryrefslogtreecommitdiffstats
path: root/src/basic/dirent-util.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* dirent-util: Expose dirent_ensure_type()Daan De Meyer2022-11-241-4/+4
|
* Typos found by codespellDimitri Papadopoulos2021-10-201-1/+1
|
* dirent-util: tweak readdir_ensure_type() a bitLennart Poettering2021-10-071-12/+28
| | | | | | | | | | So far we ignored if readdir_ensure_type() failed, the .d_type would then still possibly report DT_UNKNOWN, possibly confusing the caller. Let's make this safer: if we get an error on readdir_ensure_type() then report it — except if it is ENOENT which indicates the dirent vanished by now, which is not a problem and we should just skip to the next entry.
* dirent-util: use statx() in readdir_ensure_type()Lennart Poettering2021-10-071-4/+13
| | | | | | | | | | | | | Let's ask exactly for the one field we actually want to know, i.e. STATX_TYPE. (While we are at it, also copy over the inode number, if we have it, simply to report the most recent info we have) (Also, see AT_NO_AUTOMOUNT, so that we don't trigger automounts here. After all, if we want to know the inode type of a dirent here, then there's not need to trigger the automount, the inode type is not going to change by that.)
* dirent-util: get rid of stat_mode_to_dirent_type()Lennart Poettering2021-10-071-13/+1
| | | | | | Apparently glibc already has a helper for this. (Not in the man pages for Linux, but FreeBSD does document these cryptic helpers, and its exported by glibc. That should be good enough for us.)
* dirent-util: split out new function stat_mode_to_dirent_type()Lennart Poettering2021-10-071-9/+13
| | | | | This contains the mapping between mode_t inode type flags and dirent's d_type. Splitting this out allows us to use the mapping elsewhere later.
* dirent-util: no need to bother with fstatat() for "." and ".." to figure out ↵Lennart Poettering2021-07-081-0/+5
| | | | if these are dirs
* dirent-util: use readdir_ensure_type() in readdir_no_dot() and FOREACH_DIRENT()Yu Watanabe2021-06-231-2/+2
|
* dirent-util: introduce readdir_ensure_type()Yu Watanabe2021-06-231-2/+14
|
* license: LGPL-2.1+ -> LGPL-2.1-or-laterYu Watanabe2020-11-091-1/+1
|
* tree-wide: remove Lennart's copyright linesLennart Poettering2018-06-141-3/+0
| | | | | | | | | | | These lines are generally out-of-date, incomplete and unnecessary. With SPDX and git repository much more accurate and fine grained information about licensing and authorship is available, hence let's drop the per-file copyright notice. Of course, removing copyright lines of others is problematic, hence this commit only removes my own lines and leaves all others untouched. It might be nicer if sooner or later those could go away too, making git the only and accurate source of authorship information.
* tree-wide: drop 'This file is part of systemd' blurbLennart Poettering2018-06-141-2/+0
| | | | | | | | | | | | | | | | This part of the copyright blurb stems from the GPL use recommendations: https://www.gnu.org/licenses/gpl-howto.en.html The concept appears to originate in times where version control was per file, instead of per tree, and was a way to glue the files together. Ultimately, we nowadays don't live in that world anymore, and this information is entirely useless anyway, as people are very welcome to copy these files into any projects they like, and they shouldn't have to change bits that are part of our copyright header for that. hence, let's just get rid of this old cruft, and shorten our codebase a bit.
* tree-wide: drop license boilerplateZbigniew Jędrzejewski-Szmek2018-04-061-13/+0
| | | | | | | | | | Files which are installed as-is (any .service and other unit files, .conf files, .policy files, etc), are left as is. My assumption is that SPDX identifiers are not yet that well known, so it's better to retain the extended header to avoid any doubt. I also kept any copyright lines. We can probably remove them, but it'd nice to obtain explicit acks from all involved authors before doing that.
* Add SPDX license identifiers to source files under the LGPLZbigniew Jędrzejewski-Szmek2017-11-191-0/+1
| | | | | This follows what the kernel is doing, c.f. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5fd54ace4721fc5ce2bb5aef6318fcf17f421460.
* basic: add readdir_no_dot and safe_glob functionsZbigniew Jędrzejewski-Szmek2017-04-271-0/+11
| | | | | | safe_glob filters out "." and "..". This converts all users of glob_extend() and glob_exists() to safe_glob.
* basic/dirent-util: allow suffix to be omitted for dirent_is_file_with_suffixZbigniew Jędrzejewski-Szmek2017-02-081-0/+3
|
* tree-wide: rename hidden_file to hidden_or_backup_file and optimizeZbigniew Jędrzejewski-Szmek2016-04-281-2/+2
| | | | | | | | | | | In standard linux parlance, "hidden" usually means that the file name starts with ".", and nothing else. Rename the function to convey what the function does better to casual readers. Stop exposing hidden_file_allow_backup which is rather ugly and rewrite hidden_file to extract the suffix first. Note that hidden_file_allow_backup excluded files with "~" at the end, which is quite confusing. Let's get rid of it before it gets used in the wrong place.
* basic/dirent-util: do not call hidden_file_allow_backup from ↵Zbigniew Jędrzejewski-Szmek2016-04-271-7/+3
| | | | | | | | dirent_is_file_with_suffix If the file name is supposed to end in a suffix, there's not need to check the name against a list of "special" file names, which is slow. Instead, just check that the name doens't start with a period.
* tree-wide: remove Emacs lines from all filesDaniel Mack2016-02-101-2/+0
| | | | | This should be handled fine now by .dir-locals.el, so need to carry that stuff in every file.
* basic: include only what we useThomas Hindoe Paaboel Andersen2015-11-301-2/+1
| | | | | This is a cleaned up result of running iwyu but without forward declarations on src/basic.
* util-lib: introduce dirent-util.[ch] for directory entry callsLennart Poettering2015-10-271-0/+81
Also, move a couple of more path-related functions to path-util.c.