1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
From 0ee8d63649ab475fe2a16b2d62b5a5e2a8a69829 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Tue, 7 May 2013 11:35:23 -0400
Subject: [PATCH] systemd-sleep: it is not an error if the config file is
missing
---
src/shared/sleep-config.c | 19 ++++++++-----------
1 file changed, 8 insertions(+), 11 deletions(-)
diff --git a/src/shared/sleep-config.c b/src/shared/sleep-config.c
index 73a3acb..cd3238b 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;
--
1.8.2.2
|