From b690d120d9d52bc53142e615c244441fdba66e77 Mon Sep 17 00:00:00 2001 From: Alan Somers Date: Tue, 11 Jun 2019 16:16:16 +0000 Subject: [PATCH] fusefs: fix an infinite loop in the tests It was possible for the MockFS thread to infinitely loop if it got an error reading from /dev/fuse. Sponsored by: The FreeBSD Foundation --- tests/sys/fs/fusefs/mockfs.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/sys/fs/fusefs/mockfs.cc b/tests/sys/fs/fusefs/mockfs.cc index 620af778e8cf..c5cefe9560f4 100644 --- a/tests/sys/fs/fusefs/mockfs.cc +++ b/tests/sys/fs/fusefs/mockfs.cc @@ -637,8 +637,10 @@ void MockFS::read_request(mockfs_buf_in &in) { } res = read(m_fuse_fd, &in, sizeof(in)); - if (res < 0 && !m_quit) - perror("read"); + if (res < 0 && !m_quit) { + FAIL() << "read: " << strerror(errno); + m_quit = true; + } ASSERT_TRUE(res >= static_cast(sizeof(in.header)) || m_quit); }