summaryrefslogtreecommitdiffstats
path: root/src/core/execute.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2022-04-14 18:01:28 +0200
committerLennart Poettering <lennart@poettering.net>2022-04-22 11:32:47 +0200
commit1d68a2e1684f14c885449569c6b2d95d34ee965d (patch)
tree59d091d20ba638305e385c20af44db4092624816 /src/core/execute.c
parentexecute: restore ability to propagate creds from further up (i.e. container ... (diff)
downloadsystemd-1d68a2e1684f14c885449569c6b2d95d34ee965d.tar.xz
systemd-1d68a2e1684f14c885449569c6b2d95d34ee965d.zip
execute: restore ability that SetCredential= can act as fallback for LoadCredential=
If SetCredential= and LoadCredentials= are combined for the same credential name, then the former shall act as fallback for the latter in case the source file does not exist. That's documented, but didn't work. Let's fix that.
Diffstat (limited to 'src/core/execute.c')
-rw-r--r--src/core/execute.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/core/execute.c b/src/core/execute.c
index 5e6b1131e4..fac3be8e29 100644
--- a/src/core/execute.c
+++ b/src/core/execute.c
@@ -2792,8 +2792,10 @@ static int acquire_credentials(
if (path_is_absolute(lc->path)) {
sub_fd = open(lc->path, O_DIRECTORY|O_CLOEXEC|O_RDONLY);
- if (sub_fd < 0 && errno != ENOTDIR)
- return -errno;
+ if (sub_fd < 0 && !IN_SET(errno,
+ ENOTDIR, /* Not a directory */
+ ENOENT)) /* Doesn't exist? */
+ return log_debug_errno(errno, "Failed to open '%s': %m", lc->path);
}
if (sub_fd < 0)