summaryrefslogtreecommitdiff
path: root/src/basic/glob-util.c
Commit message (Collapse)AuthorAgeFilesLines
* glob: add glob_first(), returns first matchLuca Boccassi2022-08-231-2/+13
| | | | | Note that which match is returned depends on the system and is not guaranteed to be stable
* basic/glob-util: add helper to strip the glob part from a globZbigniew Jędrzejewski-Szmek2021-06-041-0/+19
|
* license: LGPL-2.1+ -> LGPL-2.1-or-laterYu Watanabe2020-11-091-1/+1
|
* journalctl,elsewhere: make sure --file=foo fails with sane error msg if foo ↵Lennart Poettering2020-05-191-2/+2
| | | | | | | | | | | | | is not readable It annoyed me for quite a while that running "journalctl --file=…" on a file that is not readable failed with a "File not found" error instead of a permission error. Let's fix that. We make this work by using the GLOB_NOCHECK flag for glob() which means that files are not accessible will be returned in the array as they are instead of being filtered away. This then means that our later attemps to open the files will fail cleanly with a good error message.
* tree-wide: drop glob.h when glob-util.h is includedYu Watanabe2019-11-041-1/+0
|
* tree-wide: drop dirent.h when dirent-util.h is includedYu Watanabe2019-11-041-1/+0
|
* tree-wide: make use of errno_or_else() everywhereLennart Poettering2019-07-111-2/+2
|
* headers: remove unneeded includes from util.hZbigniew Jędrzejewski-Szmek2019-03-271-0/+2
| | | | | This means we need to include many more headers in various files that simply included util.h before, but it seems cleaner to do it this way.
* 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.
* basic/glob-util: do not use names with "_" prefixZbigniew Jędrzejewski-Szmek2018-03-051-2/+2
| | | | | Names starting with _ or __ are reserved by the standard, better to avoid them.
* basic/glob-util: add closedir wrapper to silence gccZbigniew Jędrzejewski-Szmek2018-02-051-1/+5
| | | | | | | ../src/test/test-glob-util.c: In function 'test_glob_no_dot': ../src/test/test-glob-util.c:61:32: warning: cast between incompatible function types from 'int (*)(DIR *)' {aka 'int (*)(struct __dirstream *)'} to 'void (*)(void *)' [-Wcast-function-type] .gl_closedir = (void (*)(void *)) closedir, ^
* 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-24/+40
| | | | | | safe_glob filters out "." and "..". This converts all users of glob_extend() and glob_exists() to safe_glob.
* 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.
* tree-wide: check if errno is greater then zeroZbigniew Jędrzejewski-Szmek2016-01-131-2/+2
| | | | | | | | | | | | | | gcc is confused by the common idiom of return errno ? -errno : -ESOMETHING and thinks a positive value may be returned. Replace this condition with errno > 0 to help gcc and avoid many spurious warnings. I filed a gcc rfe a long time ago, but it hard to say if it will ever be implemented [1]. Both conventions were used in the codebase, this change makes things more consistent. This is a follow up to bcb161b0230f. [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61846
* basic: include only what we useThomas Hindoe Paaboel Andersen2015-11-301-2/+2
| | | | | This is a cleaned up result of running iwyu but without forward declarations on src/basic.
* util-lib: move character class definitions to string-util.hLennart Poettering2015-11-031-0/+1
|
* util-lib: split out globbing related calls into glob-util.[ch]Lennart Poettering2015-10-271-0/+71