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

Commit bda181a8 authored by David Anderson's avatar David Anderson
Browse files

libsnapshot: Fix crash in cow writer test due to missing ASSERT.

Bug: N/A
Test: vts_libsnapshot_test
Change-Id: I72cf6f52fc15061da669d14cf5d334b44ad83501
parent 111bec1e
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -298,13 +298,12 @@ bool CowWriter::Initialize(borrowed_fd fd) {
        return false;
    }

    bool ret = OpenForWrite();

    if (ret) {
        InitWorkers();
    if (!OpenForWrite()) {
        return false;
    }

    return ret;
    InitWorkers();
    return true;
}

bool CowWriter::InitializeAppend(android::base::unique_fd&& fd, uint64_t label) {
+2 −2
Original line number Diff line number Diff line
@@ -33,8 +33,8 @@ TEST_F(CompressedSnapshotWriterTest, ReadAfterWrite) {
    TemporaryFile cow_device_file{};
    android::snapshot::CowOptions options{.block_size = BLOCK_SIZE};
    android::snapshot::CompressedSnapshotWriter snapshot_writer{options};
    snapshot_writer.SetCowDevice(android::base::unique_fd{cow_device_file.fd});
    snapshot_writer.Initialize();
    ASSERT_TRUE(snapshot_writer.SetCowDevice(android::base::unique_fd{cow_device_file.fd}));
    ASSERT_TRUE(snapshot_writer.Initialize());
    std::vector<unsigned char> buffer;
    buffer.resize(BLOCK_SIZE);
    std::fill(buffer.begin(), buffer.end(), 123);