From f524b0c01c82f6b41935e891fd0692c509fad9b9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Fri, 16 Feb 2018 07:00:22 +0100 Subject: [PATCH] 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). --- src/login/logind.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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; } -- 2.30.2