summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--pkg/sentry/vfs/file_description_impl_util.go2
-rw-r--r--test/fuse/linux/readdir_test.cc9
2 files changed, 5 insertions, 6 deletions
diff --git a/pkg/sentry/vfs/file_description_impl_util.go b/pkg/sentry/vfs/file_description_impl_util.go
index 2b668fd89..68b80a951 100644
--- a/pkg/sentry/vfs/file_description_impl_util.go
+++ b/pkg/sentry/vfs/file_description_impl_util.go
@@ -107,7 +107,7 @@ func (FileDescriptionDefaultImpl) Write(ctx context.Context, src usermem.IOSeque
// file_operations::iterate == file_operations::iterate_shared == NULL in
// Linux.
func (FileDescriptionDefaultImpl) IterDirents(ctx context.Context, cb IterDirentsCallback) error {
- return syserror.ENOSYS
+ return syserror.ENOTDIR
}
// Seek implements FileDescriptionImpl.Seek analogously to
diff --git a/test/fuse/linux/readdir_test.cc b/test/fuse/linux/readdir_test.cc
index 17fb630ee..ed11e2ec9 100644
--- a/test/fuse/linux/readdir_test.cc
+++ b/test/fuse/linux/readdir_test.cc
@@ -131,7 +131,8 @@ TEST_F(ReaddirTest, SingleEntry) {
// Create an appropriately sized payload.
size_t readdir_payload_size =
test_file_dirent_size + dot_file_dirent_size + dot_dot_file_dirent_size;
- char readdir_payload[readdir_payload_size];
+ std::vector<char> readdir_payload_vec(readdir_payload_size);
+ char *readdir_payload = readdir_payload_vec.data();
fill_fuse_dirent(readdir_payload, dot.c_str());
fill_fuse_dirent(readdir_payload + dot_file_dirent_size, dot_dot.c_str());
@@ -139,10 +140,8 @@ TEST_F(ReaddirTest, SingleEntry) {
readdir_payload + dot_file_dirent_size + dot_dot_file_dirent_size,
test_file.c_str());
- std::vector<char> readdir_payload_vec(readdir_payload,
- readdir_payload + readdir_payload_size);
struct fuse_out_header readdir_header = {
- .len = uint32_t(sizeof(struct fuse_out_header) + sizeof(readdir_payload)),
+ .len = uint32_t(sizeof(struct fuse_out_header) + readdir_payload_size),
};
struct fuse_out_header readdir_header_break = {
.len = uint32_t(sizeof(struct fuse_out_header)),
@@ -185,4 +184,4 @@ TEST_F(ReaddirTest, SingleEntry) {
} // namespace
} // namespace testing
-} // namespace gvisor \ No newline at end of file
+} // namespace gvisor