]> git.ipfire.org Git - thirdparty/ccache.git/commit
Fix retrieval of object file when destination is /dev/null
authorJoel Rosdahl <joel@rosdahl.net>
Sun, 3 Jan 2021 12:39:57 +0000 (13:39 +0100)
committerJoel Rosdahl <joel@rosdahl.net>
Sun, 3 Jan 2021 13:43:46 +0000 (14:43 +0100)
commite09543bbbdea86df6b9ba1dab386bb2636980d30
tree0b5f5fbc6cfc67f803138af78a57ee73a1d4f701
parent66464308b5faf8ef42ffca2d61c648daa4ac4be7
Fix retrieval of object file when destination is /dev/null

ResultRetriever::on_entry_data assumes that a destination file has been
opened if the entry type is not stderr_output, but that’s incorrect
since on_entry_start doesn’t open a destination file if it’s /dev/null.
An assertion is triggered:

    ccache: ResultRetriever.cpp:129: virtual void
    ResultRetriever::on_entry_data(const uint8_t *, size_t): failed
    assertion: (m_dest_file_type == FileType::stderr_output &&
    !m_dest_fd) || (m_dest_file_type != FileType::stderr_output &&
    m_dest_fd)

Fix this by letting on_entry_data handle the “destination file not
opened” case and correcting the assert.

Fixes #752.
src/ResultRetriever.cpp
test/suites/base.bash