summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2018-01-27 09:32:36 +0100
committerYu Watanabe <watanabe.yu+github@gmail.com>2018-01-27 17:32:36 +0900
commit6eda13d3baf39e22143eec18c5807de4925017ec (patch)
tree6cd5d307aa4bd1d63e6eef72ed802cb035cb7d08
parentf359fb92da378213c81c3b6f7aacfce132260114 (diff)
downloadsystemd-6eda13d3baf39e22143eec18c5807de4925017ec.tar.gz
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
-rw-r--r--src/journal/journal-file.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/journal/journal-file.c b/src/journal/journal-file.c
index ae15f4b76a..3353b3a0d8 100644
--- a/src/journal/journal-file.c
+++ b/src/journal/journal-file.c
@@ -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)