coredumpctl: rework presence reporting
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 26 Sep 2016 23:41:38 +0000 (01:41 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 28 Sep 2016 21:49:01 +0000 (23:49 +0200)
commit04de587942054c414beda54af303880851b0fa4c
tree5f0f4202532e12fcb68a9d5c51b07fdf84d57ef6
parent47f50642075a7a215c9f7b600599cbfee81a2913
coredumpctl: rework presence reporting

The column for "present" was easy to miss, especially if somebody had no
coredumps present at all, in which case the column of spaces of width one
wasn't visually distinguished from the neighbouring columns. Replace this
with an explicit text, one of: "missing", "journal", "present", "error".

$ coredumpctl
TIME                            PID   UID   GID SIG COREFILE EXE
Mon 2016-09-26 22:46:31 CEST   8623     0     0  11 missing  /usr/bin/bash
Mon 2016-09-26 22:46:35 CEST   8639  1001  1001  11 missing  /usr/bin/bash
Tue 2016-09-27 01:10:46 CEST  16110  1001  1001  11 journal  /usr/bin/bash
Tue 2016-09-27 01:13:20 CEST  16290  1001  1001  11 journal  /usr/bin/bash
Tue 2016-09-27 01:33:48 CEST  17867  1001  1001  11 present  /usr/bin/bash
Tue 2016-09-27 01:37:55 CEST  18549     0     0  11 error    /usr/bin/bash

Also, use access(…, R_OK), so that we can report a present but inaccessible
file different than a missing one.
src/coredump/coredumpctl.c