[PATCH 07/17] lxc_fuse: Prefer O_ACCMODE instead of & 3

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 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;
-- 
2.34.1




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux