From 67225a96e59715307f69e614291d4083656cac79 Mon Sep 17 00:00:00 2001 From: i-do-cpp Date: Sat, 4 Jun 2022 22:18:05 +0200 Subject: [PATCH] fix: sd_id128_get_invocation now works for user services --- src/libsystemd/sd-id128/sd-id128.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/libsystemd/sd-id128/sd-id128.c b/src/libsystemd/sd-id128/sd-id128.c index b81cd6ca8b..183d34054d 100644 --- a/src/libsystemd/sd-id128/sd-id128.c +++ b/src/libsystemd/sd-id128/sd-id128.c @@ -256,7 +256,10 @@ _public_ int sd_id128_get_invocation(sd_id128_t *ret) { /* We first check the environment. The environment variable is primarily relevant for user * services, and sufficiently safe as long as no privilege boundary is involved. */ r = get_invocation_from_environment(&saved_invocation_id); - if (r < 0 && r != -ENXIO) + if (r >= 0) { + *ret = saved_invocation_id; + return 0; + } else if (r != -ENXIO) return r; /* The kernel keyring is relevant for system services (as for user services we don't store -- 2.25.1