From 6996df9b864981980f5b713dc5c7d506a7a4b9bf Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 8 Aug 2018 16:03:11 +0200 Subject: [PATCH] logind: improve error propagation of user_check_linger_file() Let's make this a bit prettier, and propagate unexpected access() errors correctly. (The callers of this function will suppress them, but it's nicer of they do that, rather than us doing that twice in both the callers and the callees) --- src/login/logind-user.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/login/logind-user.c b/src/login/logind-user.c index e92f2a5243..230c8f392d 100644 --- a/src/login/logind-user.c +++ b/src/login/logind-user.c @@ -530,8 +530,14 @@ int user_check_linger_file(User *u) { return -ENOMEM; p = strjoina("/var/lib/systemd/linger/", cc); + if (access(p, F_OK) < 0) { + if (errno != ENOENT) + return -errno; - return access(p, F_OK) >= 0; + return false; + } + + return true; } bool user_may_gc(User *u, bool drop_not_started) { -- 2.25.1