mirror of https://github.com/mamba-org/mamba.git
Fix compilation with -Werror=unused-result (#3676)
Signed-off-by: dann frazier <dann.frazier@chainguard.dev>
This commit is contained in:
parent
0b43dbcce2
commit
693ee82c7b
|
@ -48,11 +48,3 @@ repos:
|
|||
rev: v0.6.13
|
||||
hooks:
|
||||
- id: cmake-format
|
||||
- repo: https://github.com/Quantco/pre-commit-mirrors-typos
|
||||
rev: 1.27.3
|
||||
hooks:
|
||||
- id: typos-conda
|
||||
exclude: (CHANGELOG.md)
|
||||
# In case of ambiguity (multiple possible corrections), `typos` will just report it to the user and move on without applying/writing any changes.
|
||||
# cf. https://github.com/crate-ci/typos
|
||||
args: [ --write-changes ]
|
||||
|
|
|
@ -196,18 +196,19 @@ void
|
|||
read_binary_from_stdin_and_write_to_file(fs::u8path& filename)
|
||||
{
|
||||
std::ofstream out_stream = open_ofstream(filename, std::ofstream::binary);
|
||||
FILE* stdin_bin;
|
||||
// Need to reopen stdin as binary
|
||||
std::freopen(nullptr, "rb", stdin);
|
||||
if (std::ferror(stdin))
|
||||
stdin_bin = std::freopen(nullptr, "rb", stdin);
|
||||
if (std::ferror(stdin_bin))
|
||||
{
|
||||
throw std::runtime_error("Re-opening stdin as binary failed.");
|
||||
}
|
||||
std::size_t len;
|
||||
std::array<char, 1024> buffer;
|
||||
|
||||
while ((len = std::fread(buffer.data(), sizeof(char), buffer.size(), stdin)) > 0)
|
||||
while ((len = std::fread(buffer.data(), sizeof(char), buffer.size(), stdin_bin)) > 0)
|
||||
{
|
||||
if (std::ferror(stdin) && !std::feof(stdin))
|
||||
if (std::ferror(stdin_bin) && !std::feof(stdin_bin))
|
||||
{
|
||||
throw std::runtime_error("Reading from stdin failed.");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue