1
0
mirror of https://github.com/systemd/systemd.git synced 2025-03-22 06:50:18 +03:00

journal: losen restrictions on journal file suffix (#8013)

Previously, we'd refuse open journal files with suffixes that aren't
either .journal or .journal~. With this change we only care when we are
creating the journal file.

I looked over the sources to see whether we ever pass files discovered
by directory enumeration to journal_file_open() without first checking
the suffix (in which case the old check made sense), but I couldn't find
any. hence I am pretty sure removing this check is safe.

Fixes: #7972
This commit is contained in:
Lennart Poettering 2018-01-27 09:32:36 +01:00 committed by Yu Watanabe
parent f359fb92da
commit 6eda13d3ba

View File

@ -3253,11 +3253,8 @@ int journal_file_open(
if (!IN_SET((flags & O_ACCMODE), O_RDONLY, O_RDWR))
return -EINVAL;
if (fname) {
if (!endswith(fname, ".journal") &&
!endswith(fname, ".journal~"))
return -EINVAL;
}
if (fname && (flags & O_CREAT) && !endswith(fname, ".journal"))
return -EINVAL;
f = new0(JournalFile, 1);
if (!f)