Skip to content

Commit

Permalink
fix: remove ub from some logic errors
Browse files Browse the repository at this point in the history
  • Loading branch information
MiroPalmu committed Jan 18, 2025
1 parent 6c88b62 commit a65efbc
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/fd_handle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ void fd_handle::close() {
case 0: return;
case -1: sstd::throw_generic_system_error();
}
std::unreachable();
throw std::logic_error{ "Unregonized error code from gnulib::close(fd)." };
}

auto fd_handle::get_PIPE_BUF() const -> unsigned long {
Expand Down
2 changes: 1 addition & 1 deletion src/memory_block.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ namespace {
}
return fd;
}
std::unreachable();
throw std::logic_error{ "Unhandeled state from fd_safer_flag(fd, O_CLOEXEC)." };
}
throw std::runtime_error{
std::format("Could not create POSIX shm object with unique name after {} times.", max_tries)
Expand Down
2 changes: 1 addition & 1 deletion src/pipe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ namespace gnulander {
case 0: return { fd_handle{ raw_pipe_fd.front() }, fd_handle{ raw_pipe_fd.back() } };
case -1: sstd::throw_generic_system_error();
}
std::unreachable();
throw std::logic_error{ "Unregonized error code from ::pipe2_safer(fd, O_CLOEXEC)." };
}

} // namespace gnulander

0 comments on commit a65efbc

Please sign in to comment.