summaryrefslogtreecommitdiffstats
path: root/src/shared/sleep-config.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2024-02-22 10:50:05 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2024-03-07 19:14:36 +0100
commit6378f257e7e7856abc32cd9b5cb33bc4c63903be (patch)
treed0e7cb675bf137a91b5277a726e43b091cede105 /src/shared/sleep-config.c
parentshared/conf-parser: add function which implements the standard config file set (diff)
downloadsystemd-6378f257e7e7856abc32cd9b5cb33bc4c63903be.tar.xz
systemd-6378f257e7e7856abc32cd9b5cb33bc4c63903be.zip
various: use new config loader instead of config_parse_config_file()
This means the main config file is loaded also from /run and /usr. We should load the main config file from all the places where we load drop-ins. I realize I had a giant blind spot: I always assumed that we load config files from /etc, /run, /usr/local/lib, /usr/lib. But it turns out that we only used those paths for drop-ins. For the main config file, we only looked in /etc. The docs actually partially described this behaviour, i.e. most SYNOPSIS sections and some parts of the text, but not others. This is strange, because 6495361c7d5e8bf640841d1292ef6cfe1ea244cf was completely bogus with the behaviour before this patch. We had a huge discussion before it was merged, and clearly nobody noticed this. Similarly, in the previous version of the current pull request, we had a long discussion about the appropriate order of directories, and apparently nobody noticed that there was no order, because only looked in one directory. So the blind spot seems to have been shared. Also, systemd-analyze cat-config behaved incorrectly, i.e. its behaviour matches the new behaviour. Possibly, in the future it'll make it easier to add support for --root.
Diffstat (limited to 'src/shared/sleep-config.c')
-rw-r--r--src/shared/sleep-config.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/shared/sleep-config.c b/src/shared/sleep-config.c
index 19b75a706d..c96f8485dd 100644
--- a/src/shared/sleep-config.c
+++ b/src/shared/sleep-config.c
@@ -145,9 +145,12 @@ int parse_sleep_config(SleepConfig **ret) {
{}
};
- (void) config_parse_config_file("systemd/sleep.conf", "Sleep\0",
- config_item_table_lookup, items,
- CONFIG_PARSE_WARN, NULL);
+ (void) config_parse_standard_file_with_dropins(
+ "systemd/sleep.conf",
+ "Sleep\0",
+ config_item_table_lookup, items,
+ CONFIG_PARSE_WARN,
+ /* userdata= */ NULL);
/* use default values unless set */
sc->allow[SLEEP_SUSPEND] = allow_suspend != 0;