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
This commit is contained in:
Alan Somers 2019-06-11 16:16:16 +00:00
parent d53a96f16f
commit b690d120d9
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/projects/fuse2/; revision=348930

View File

@ -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<ssize_t>(sizeof(in.header)) || m_quit);
}