[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 4/7] tests: virtio-9p: TLOPEN should fail to open a
From: |
Greg Kurz |
Subject: |
[Qemu-devel] [PATCH 4/7] tests: virtio-9p: TLOPEN should fail to open a FIFO |
Date: |
Tue, 10 Jan 2017 15:32:34 +0100 |
User-agent: |
StGit/0.17.1-20-gc0b1b-dirty |
A 9P server should only try to open regular files and directories.
Signed-off-by: Greg Kurz <address@hidden>
---
tests/virtio-9p-test.c | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/tests/virtio-9p-test.c b/tests/virtio-9p-test.c
index 14b4787930ae..334833f88a6e 100644
--- a/tests/virtio-9p-test.c
+++ b/tests/virtio-9p-test.c
@@ -537,6 +537,29 @@ static void fs_lopen(QVirtIO9P *v9p)
g_free(wnames[0]);
}
+static void fs_lopen_fifo_not_allowed(QVirtIO9P *v9p)
+{
+ char *const wnames[] = { g_strdup(__func__) };
+ char *test_fifo;
+ P9Req *req;
+ uint32_t err;
+
+ test_fifo = g_strdup_printf("%s/%s", v9p->test_share, wnames[0]);
+ g_assert(mkfifo(test_fifo, 0600) == 0);
+
+ fs_attach(v9p);
+ req = v9fs_twalk(v9p, 0, 1, 1, wnames);
+ v9fs_rwalk(req, NULL, NULL);
+ req = v9fs_tlopen(v9p, 1, O_RDONLY);
+ v9fs_rlerror(req, &err);
+
+ g_assert_cmpint(err, ==, EINVAL);
+
+ unlink(test_fifo);
+ g_free(test_fifo);
+ g_free(wnames[0]);
+}
+
typedef void (*v9fs_test_fn)(QVirtIO9P *v9p);
static void v9fs_run_pci_test(gconstpointer data)
@@ -567,6 +590,8 @@ int main(int argc, char **argv)
v9fs_qtest_pci_add("/virtio/9p/pci/fs/walk/dotdot_from_root",
fs_walk_dotdot);
v9fs_qtest_pci_add("/virtio/9p/pci/fs/lopen/basic", fs_lopen);
+ v9fs_qtest_pci_add("/virtio/9p/pci/fs/lopen/fifo_not_allowed",
+ fs_lopen_fifo_not_allowed);
return g_test_run();
}
- [Qemu-devel] [PATCH 0/7] fix potential hangs in 9pfs, Greg Kurz, 2017/01/10
- [Qemu-devel] [PATCH 1/7] 9pfs: restrict open to regular files and directories, Greg Kurz, 2017/01/10
- [Qemu-devel] [PATCH 2/7] tests: virtio-9p: improve error reporting, Greg Kurz, 2017/01/10
- [Qemu-devel] [PATCH 3/7] tests: virtio-9p: add LOPEN operation test, Greg Kurz, 2017/01/10
- [Qemu-devel] [PATCH 4/7] tests: virtio-9p: TLOPEN should fail to open a FIFO,
Greg Kurz <=
- [Qemu-devel] [PATCH 5/7] 9pfs: don't create files if pathname already exists, Greg Kurz, 2017/01/10
- [Qemu-devel] [PATCH 6/7] tests: virtio-9p: add LCREATE operation test, Greg Kurz, 2017/01/10
- [Qemu-devel] [PATCH 7/7] tests: virtio-9p: TLCREATE should fail if pathname exists, Greg Kurz, 2017/01/10