summaryrefslogtreecommitdiffstats
path: root/src/shared/kbd-util.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* kbd-util: allow to override the default keymap directoriesYu Watanabe2024-03-141-8/+37
| | | | | | | | | | | | | | This introduces $SYSTEMD_KEYMAP_DIRECTORIES environment variable to override the hardcoded keymap directories. I think it is not necessary to provide the first class configuration option for controlling the keymap directories, but it is not good to hardcode the paths. So, let's introduce an environment variable to override that. Prompted by #31759. Closes #31759.
* shared/kbd-util: simplify error handling in keymap_exists()Zbigniew Jędrzejewski-Szmek2023-08-161-11/+7
| | | | | Once we know the return value, we can just return it, no need to exit the loop.
* various: use _NEG_ macros to reduce indentationZbigniew Jędrzejewski-Szmek2023-08-161-7/+5
| | | | No functional change intended.
* kbd-util: fix use of ERRNO_IS_RESOURCE()Dmitry V. Levin2023-07-161-4/+4
| | | | | | | | | | | Given that ERRNO_IS_RESOURCE() also matches positive values, make sure this macro is not called with arguments that do not have errno semantics. In this case the argument passed to ERRNO_IS_RESOURCE() is the value returned by recurse_dir_at() which can legitimately return positive values without errno semantics, so fix this by moving the ERRNO_IS_RESOURCE() invocation to the branch where the return value is known to be negative.
* tree-wide: use _cleanup_set_free_ and friendsYu Watanabe2023-05-311-1/+1
| | | | Instead of _cleanup_(set_freep) or so.
* nulstr-util: Declare NULSTR_FOREACH() iterator inlineDaan De Meyer2022-11-111-2/+0
|
* kbd-util: port from nftw() to recurse_dir()Lennart Poettering2021-10-071-51/+80
|
* shared/kbd-util: simplify suffix strippingZbigniew Jędrzejewski-Szmek2021-03-041-10/+5
| | | | It only came to me now that this can be prettified.
* localed: refuse to set a keymap which is not installedZbigniew Jędrzejewski-Szmek2021-03-041-0/+29
| | | | | | | | | | | | | | | | | | | In https://bugzilla.redhat.com/show_bug.cgi?id=1933873 a keymap was set without the package that provides it being installed (it2 is in kbd-legacy, which is not installed by default). Setting a non-installed keymap is problematic, because it results in nasty failures afterward (*). So let's to the same as e.g. for locale data, and refuse a setting if the definition doesn't exists in the filesystem. The implementation using nftw() is not the most efficient, but I think it's OK in this case. This is definitely not in any kind of hot path, and I prefer not to duplicate the filename manipulation logic in a second function. (*) If the keymap is not found, vconsole-setup.service will fail. dracut-cmdline-ask.service has Requires=vconsole-setup.service, so it will also fail, and this breaks boot. dracut-cmdline-ask.service having a hard dependency is appropriate though: we sadly don't display what the keymap is, and with a wrong keymap, any attempts to enter a password are likely to fail.
* shared/kbd-util: return error on resource errorsZbigniew Jędrzejewski-Szmek2021-03-041-2/+8
| | | | I guess we should still not fail on failure to access a directory and such.
* shared/kbd-util: fix return value confusion with nftw()Zbigniew Jędrzejewski-Szmek2021-03-041-23/+19
| | | | | | | | | | | | | | We would return a real error sometimes from the callback, and FTW_STOP other times. Because of FTW_ACTIONRETVAL, everything except FTW_STOP would be ignored. I don't think using FTW_ACTIONRETVAL is useful. nftw() can only be used meaningfully with errno. Even if we return a proper value ourselves from the callback, it will be propagated as a return value from nftw(), but there is no way to distinguish this from a value generated by nftw() itself, which is -1/-EPERM on error. So let's set errno ourselves so the caller can at least look at that. The code still ignores all errors.
* Move basic/kbd-util to shared/Zbigniew Jędrzejewski-Szmek2021-03-041-0/+108
It is (or should be used) in localectl, localed, and a few other places, no reason to keep it in basic/.