]> git.ipfire.org Git - thirdparty/systemd.git/commit
journalctl,elsewhere: make sure --file=foo fails with sane error msg if foo is not...
authorLennart Poettering <lennart@poettering.net>
Tue, 12 May 2020 21:36:27 +0000 (23:36 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 19 May 2020 13:26:51 +0000 (15:26 +0200)
commit544e146b0e2f6227e28476e36becd1019b14ef70
tree8450917615e475793f51485c6a8be25dce0fc647
parent7f6b827f365b98965af159a5f6dc19aa3158ae4a
journalctl,elsewhere: make sure --file=foo fails with sane error msg if foo is not readable

It annoyed me for quite a while that running "journalctl --file=…" on a
file that is not readable failed with a "File not found" error instead
of a permission error. Let's fix that.

We make this work by using the GLOB_NOCHECK flag for glob() which means
that files are not accessible will be returned in the array as they are
instead of being filtered away. This then means that our later attemps
to open the files will fail cleanly with a good error message.
src/basic/glob-util.c
src/basic/glob-util.h
src/basic/path-util.c
src/coredump/coredumpctl.c
src/journal-remote/journal-upload.c
src/journal/journalctl.c
src/sysctl/sysctl.c