summaryrefslogtreecommitdiffstats
path: root/src/shared/condition.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2022-03-10 16:47:51 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2022-03-29 16:17:56 +0200
commit99aad9a2b9e2c06023a2043976fd9395332ff097 (patch)
tree83f451c5ecbb365e13bcea180f8f6ec9dc729fbb /src/shared/condition.c
parentshared/install: return failure when enablement fails, but process as much as ... (diff)
downloadsystemd-99aad9a2b9e2c06023a2043976fd9395332ff097.tar.xz
systemd-99aad9a2b9e2c06023a2043976fd9395332ff097.zip
systemctl: fix silent failure when --root is not found
Some calls to lookup_path_init() were not followed by any log emission. E.g.: $ SYSTEMD_LOG_LEVEL=debug systemctl --root=/missing enable unit; echo $? 1 Let's add a helper function and use it in various places. $ SYSTEMD_LOG_LEVEL=debug build/systemctl --root=/missing enable unit; echo $? Failed to initialize unit search paths for root directory /missing: No such file or directory 1 $ SYSTEMCTL_SKIP_SYSV=1 build/systemctl --root=/missing enable unit; echo $? Failed to initialize unit search paths for root directory /missing: No such file or directory Failed to enable: No such file or directory. 1 The repeated error in the second case is not very nice, but this is a niche case and I don't think it's worth the trouble to trying to avoid it.
Diffstat (limited to 'src/shared/condition.c')
-rw-r--r--src/shared/condition.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/shared/condition.c b/src/shared/condition.c
index 0a4072c9be..15b22a4006 100644
--- a/src/shared/condition.c
+++ b/src/shared/condition.c
@@ -785,7 +785,8 @@ static int condition_test_needs_update(Condition *c, char **env) {
if (r < 0) {
log_debug_errno(r, "Failed to parse timestamp file '%s', using mtime: %m", p);
return true;
- } else if (r == 0) {
+ }
+ if (isempty(timestamp_str)) {
log_debug("No data in timestamp file '%s', using mtime.", p);
return true;
}