diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2018-02-16 07:00:22 +0100 |
---|---|---|
committer | Sven Eden <yamakuzure@gmx.net> | 2018-05-30 07:58:58 +0200 |
commit | f524b0c01c82f6b41935e891fd0692c509fad9b9 (patch) | |
tree | 5f63aaffad81ecfbe931c1674d37d986ede04566 /src/login/logind.c | |
parent | be2283cf9e565994ae6db0db57a555c6db704fe0 (diff) |
Add some handling to remaining unlinkat calls
Coverity now started warning about this ("Calling unlinkat without checking
return value (as is done elsewhere 12 out of 15 times).", and it is right:
most of the time we should at list print a log message so people can figure
out something is wrong when this happens.
v2:
- use warning level in journald too (this is unlikely to happen ever, so it
should be safe to something that is visible by default).
Diffstat (limited to 'src/login/logind.c')
-rw-r--r-- | src/login/logind.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/login/logind.c b/src/login/logind.c index 10cec3566..7246c13ec 100644 --- a/src/login/logind.c +++ b/src/login/logind.c @@ -350,7 +350,9 @@ static int manager_enumerate_seats(Manager *m) { s = hashmap_get(m->seats, de->d_name); if (!s) { - unlinkat(dirfd(d), de->d_name, 0); + if (unlinkat(dirfd(d), de->d_name, 0) < 0) + log_warning("Failed to remove /run/systemd/seats/%s: %m", + de->d_name); continue; } |