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

sd-journal: refuse invocation of journal_file_open() with O_RDONLY|O_CREAT

This commit is contained in:
Lennart Poettering 2022-03-21 18:12:53 +01:00
parent ca8503f168
commit d120d897ec

View File

@ -3336,6 +3336,9 @@ int journal_file_open(
if (!IN_SET((flags & O_ACCMODE), O_RDONLY, O_RDWR))
return -EINVAL;
if ((flags & O_ACCMODE) == O_RDONLY && FLAGS_SET(flags, O_CREAT))
return -EINVAL;
if (fname && (flags & O_CREAT) && !endswith(fname, ".journal"))
return -EINVAL;