diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/fuse_lowlevel.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/lib/fuse_lowlevel.c b/lib/fuse_lowlevel.c index ef1cda5..220a263 100644 --- a/lib/fuse_lowlevel.c +++ b/lib/fuse_lowlevel.c @@ -9,6 +9,7 @@ See the file COPYING.LIB */ +#include <stdbool.h> #define _GNU_SOURCE #include "fuse_config.h" @@ -1965,6 +1966,18 @@ static void do_lseek(fuse_req_t req, fuse_ino_t nodeid, const void *inarg) fuse_reply_err(req, ENOSYS); } +static bool want_flags_valid(uint64_t capable, uint64_t want) +{ + uint64_t unknown_flags = want & (~capable); + if (unknown_flags != 0) { + fuse_log(FUSE_LOG_ERR, + "fuse: unknown connection 'want' flags: 0x%08lx\n", + unknown_flags); + return false; + } + return true; +} + /* Prevent bogus data races (bogus since "init" is called before * multi-threading becomes relevant */ static __attribute__((no_sanitize("thread"))) @@ -2121,10 +2134,7 @@ void do_init(fuse_req_t req, fuse_ino_t nodeid, const void *inarg) if (se->op.init) se->op.init(se->userdata, &se->conn); - if (se->conn.want & (~se->conn.capable)) { - fuse_log(FUSE_LOG_ERR, "fuse: error: filesystem requested capabilities " - "0x%x that are not supported by kernel, aborting.\n", - se->conn.want & (~se->conn.capable)); + if (!want_flags_valid(se->conn.capable, se->conn.want)) { fuse_reply_err(req, EPROTO); se->error = -EPROTO; fuse_session_exit(se); |