[PATCH 2/4] qualify: fix signal=SIG_0 and signal=0 do not print error message
JingPiao Chen
chenjingpiao at gmail.com
Fri Jan 6 07:16:28 UTC 2017
SIG_0 is not valid signal name, do not have signal number is 0.
Maybe not have greatly effect, but print error message is friendly.
* qualify.c (sigstr_to_uint): Compare signal number to zero.
Change index start from one.
---
qualify.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/qualify.c b/qualify.c
index fd20349..fd012ee 100644
--- a/qualify.c
+++ b/qualify.c
@@ -154,13 +154,15 @@ sigstr_to_uint(const char *s)
{
int i;
- if (*s >= '0' && *s <= '9')
- return string_to_uint_upto(s, 255);
+ if (*s >= '0' && *s <= '9') {
+ int signum = string_to_uint_upto(s, 255);
+ return signum > 0 ? signum : -1;
+ }
if (strncasecmp(s, "SIG", 3) == 0)
s += 3;
- for (i = 0; i <= 255; ++i) {
+ for (i = 1; i <= 255; ++i) {
const char *name = signame(i);
if (strncasecmp(name, "SIG", 3) != 0)
--
2.7.4
More information about the Strace-devel
mailing list