Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 004187ac authored by Daniel Zheng's avatar Daniel Zheng Committed by Gerrit Code Review
Browse files

Merge "libsnapshot: add check for updating next_data_pos_" into main

parents 6fe95136 070848b9
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -399,8 +399,14 @@ bool CowWriterV3::EmitSequenceData(size_t num_ops, const uint32_t* data) {
                      "operation writes.";
        return false;
    }

    header_.sequence_data_count = num_ops;

    // Ensure next_data_pos_ is updated as previously initialized + the newly added sequence buffer.
    CHECK_EQ(next_data_pos_ + header_.sequence_data_count * sizeof(uint32_t),
             GetDataOffset(header_));
    next_data_pos_ = GetDataOffset(header_);

    if (!android::base::WriteFullyAtOffset(fd_, data, sizeof(data[0]) * num_ops,
                                           GetSequenceOffset(header_))) {
        PLOG(ERROR) << "writing sequence buffer failed";