Skip to content

Commit

Permalink
use strsignal to display signal name
Browse files Browse the repository at this point in the history
Replace sigabbrev_np with strsignal. sibabbrev_np is not available
before glibc 2.32.

Change-Id: Ia031b760d8267d3dfd96a97fac28f373c57ac3cc
  • Loading branch information
oliverlee committed Aug 24, 2024
1 parent fbbaabd commit 23588b9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/aborts.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#include <cstring>
#include <optional>
#include <ostream>
// https://www.man7.org/linux/man-pages/man3/strsignal.3.html
#include <string.h> // NOLINT(modernize-deprecated-headers)
#include <sys/wait.h>
#include <unistd.h>
#include <utility>
Expand Down Expand Up @@ -33,8 +35,7 @@ struct aborts_fn
os << "exited: " << WEXITSTATUS(*r.status);
}
if (WIFSIGNALED(*r.status)) {
os << "terminated due to signal: SIG"
<< sigabbrev_np(WTERMSIG(*r.status));
os << "terminated due to signal: " << strsignal(WTERMSIG(*r.status));
}
}
return os;
Expand Down
2 changes: 1 addition & 1 deletion test/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ skytest_test(
"does not abort.*FAIL",
"exited: 0",
"terminates due to sigint.*FAIL",
"signal: SIGINT",
"signal: Interrupt",
"exits without abort.*FAIL",
"exited: 1",
"1 test passed.*3 tests failed",
Expand Down

0 comments on commit 23588b9

Please sign in to comment.