From 320efa9572dbd2f6b5c904efad11798020da40c4 Mon Sep 17 00:00:00 2001 From: Michal Privoznik Date: Mon, 28 Feb 2022 12:53:39 +0100 Subject: [PATCH] lxc_fuse: Prefer O_ACCMODE instead of & 3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Ján Tomko --- src/lxc/lxc_fuse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lxc/lxc_fuse.c b/src/lxc/lxc_fuse.c index b6b653e8cd..683d01525f 100644 --- a/src/lxc/lxc_fuse.c +++ b/src/lxc/lxc_fuse.c @@ -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;