summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-05-07 11:35:23 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-05-07 11:47:50 -0400
commit0ee8d63649ab475fe2a16b2d62b5a5e2a8a69829 (patch)
tree72202dc8cccf1d73859c5e5e3efb69196dc0b399
parent4d5fb96252d289e7899bc0bb87262127d19de949 (diff)
systemd-sleep: it is not an error if the config file is missing
-rw-r--r--src/shared/sleep-config.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/src/shared/sleep-config.c b/src/shared/sleep-config.c
index 73a3acb8be..cd3238b405 100644
--- a/src/shared/sleep-config.c
+++ b/src/shared/sleep-config.c
@@ -47,19 +47,16 @@ int parse_sleep_config(const char *verb, char ***modes, char ***states) {
FILE _cleanup_fclose_ *f;
f = fopen(PKGSYSCONFDIR "/sleep.conf", "re");
- if (!f) {
- if (errno == ENOENT)
- return 0;
-
- log_warning("Failed to open configuration file " PKGSYSCONFDIR "/sleep.conf: %m");
- return 0;
+ if (!f)
+ log_full(errno == ENOENT ? LOG_DEBUG: LOG_WARNING,
+ "Failed to open configuration file " PKGSYSCONFDIR "/sleep.conf: %m");
+ else {
+ r = config_parse(NULL, PKGSYSCONFDIR "/sleep.conf", f, "Sleep\0",
+ config_item_table_lookup, (void*) items, false, false, NULL);
+ if (r < 0)
+ log_warning("Failed to parse configuration file: %s", strerror(-r));
}
- r = config_parse(NULL, PKGSYSCONFDIR "/sleep.conf", f, "Sleep\0",
- config_item_table_lookup, (void*) items, false, false, NULL);
- if (r < 0)
- log_warning("Failed to parse configuration file: %s", strerror(-r));
-
if (streq(verb, "suspend")) {
/* empty by default */
*modes = suspend_mode;