diff options
-rw-r--r-- | src/user/lib/fs/misc.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/user/lib/fs/misc.c b/src/user/lib/fs/misc.c index 7922659..46d47eb 100644 --- a/src/user/lib/fs/misc.c +++ b/src/user/lib/fs/misc.c @@ -70,14 +70,13 @@ void fs_whitelist(const char **list) { struct fs_wait_response res; const size_t buf_len = 1024; char *buf = malloc(buf_len); - char *ipath; bool passthru, inject; struct dirbuild db; if (!buf) exit(1); while (!c0_fs_wait(buf, buf_len, &res)) { + char *ipath = res.id; size_t blen; - ipath = res.id; switch (res.op) { case VFSOP_OPEN: passthru = false; @@ -85,11 +84,13 @@ void fs_whitelist(const char **list) { for (const char **iter = list; *iter; iter++) { size_t len = strlen(*iter); + bool ro = false; if (len >= 3 && !memcmp(*iter + len - 3, ":ro", 3)) { - res.flags = res.flags | OPEN_RO; + ro = true; len -= 3; } if (len <= res.len && !memcmp(buf, *iter, len)) { + if (ro) res.flags |= OPEN_RO; passthru = true; break; } |