1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-22 17:34:18 +03:00

lxc_fuse: Prefer O_ACCMODE instead of & 3

In lxcProcOpen() we want to check whether the /proc/memfile is
being opened only for read. For that we check the fi->flags which
correspond to flags open() call. Instead of explicitly masking
the last two bits use O_ACCMODE constant, which is deemed to be
more portable.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Michal Privoznik 2022-02-28 12:53:39 +01:00
parent 82e0f18b85
commit 320efa9572

View File

@ -114,7 +114,7 @@ lxcProcOpen(const char *path,
if (STRNEQ(path, fuse_meminfo_path))
return -ENOENT;
if ((fi->flags & 3) != O_RDONLY)
if ((fi->flags & O_ACCMODE) != O_RDONLY)
return -EACCES;
return 0;