From e0fb7735bc675b03fb7feb3379c847768ac8dece Mon Sep 17 00:00:00 2001 From: robk-tahoe Date: Mon, 20 Oct 2008 07:30:52 -0700 Subject: [PATCH] fuse/blackmatch: fix platform specific problems in repr_flags the repr_flags debug/logging function had a list of fields from the os module that might be passed into an open() call, but it included at least one which was available on the mac but not on linux. symmetrically linux has numerous flags which are not present on the mac. the repr_flags function is now tolerant of flags not being present, and has an expanded list of flags --- contrib/fuse/impl_c/blackmatch.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/contrib/fuse/impl_c/blackmatch.py b/contrib/fuse/impl_c/blackmatch.py index 322df4e2..c45c0ae8 100644 --- a/contrib/fuse/impl_c/blackmatch.py +++ b/contrib/fuse/impl_c/blackmatch.py @@ -194,11 +194,13 @@ def repr_mode(mode=None): def repr_flags(flags=None): if flags is None: return 'none' - fields = ['O_WRONLY', 'O_RDWR', 'O_NONBLOCK', 'O_APPEND', 'O_CREAT', 'O_TRUNC', 'O_EXCL', 'O_SHLOCK', 'O_EXLOCK', 'O_NOFOLLOW'] + fields = [ 'O_APPEND', 'O_CREAT', 'O_DIRECT', 'O_DIRECTORY', 'O_EXCL', 'O_EXLOCK', + 'O_LARGEFILE', 'O_NDELAY', 'O_NOCTTY', 'O_NOFOLLOW', 'O_NONBLOCK', 'O_RDWR', + 'O_SHLOCK', 'O_SYNC', 'O_TRUNC', 'O_WRONLY', ] ret = [] for field in fields: - fval = getattr(os, field) - if (flags & fval) == fval: + fval = getattr(os, field, None) + if fval is not None and (flags & fval) == fval: ret.append(field) if not ret: ret = ['O_RDONLY'] -- 2.45.2