From: Lennart Poettering Date: Wed, 8 Aug 2018 14:03:11 +0000 (+0200) Subject: logind: improve error propagation of user_check_linger_file() X-Git-Tag: v240~549^2~7 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6996df9b864981980f5b713dc5c7d506a7a4b9bf;p=thirdparty%2Fsystemd.git 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) --- diff --git a/src/login/logind-user.c b/src/login/logind-user.c index e92f2a5243f..230c8f392d5 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) {