From: Zbigniew Jędrzejewski-Szmek Date: Fri, 16 Feb 2018 06:00:22 +0000 (+0100) Subject: Add some handling to remaining unlinkat calls X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=f524b0c01c82f6b41935e891fd0692c509fad9b9;p=elogind.git 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). --- 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; }