From edd01372bc4a4afb26273466843a7c63d95a92d1 Mon Sep 17 00:00:00 2001 From: Derek Weitzel Date: Fri, 13 Feb 2026 11:21:39 -0600 Subject: [PATCH] Handle non-sequential writes by disabling checksum calculation and updating offset correctly --- src/multiuser.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/multiuser.cpp b/src/multiuser.cpp index 522cff3..9fe0add 100644 --- a/src/multiuser.cpp +++ b/src/multiuser.cpp @@ -177,13 +177,14 @@ ssize_t MultiuserFile::Write(const void *buffer, off_t offset, size_t size) if ((offset != m_nextoff) && m_state) { std::stringstream ss; - ss << "Out-of-order writes not supported while running checksum. " << m_fname; + ss << "Non-sequential write detected; disabling checksum calculation for " << m_fname; m_log.Emsg("Write", ss.str().c_str()); - return -ENOTSUP; + delete m_state; + m_state = NULL; } auto result = m_wrapped->Write(buffer, offset, size); - if (result >= 0) {m_nextoff += result;} + if (result >= 0) {m_nextoff = offset + result;} if (m_state) { m_state->Update(static_cast(buffer), size);