diff options
author | Igor Pashev <pashev.igor@gmail.com> | 2014-09-30 18:22:48 +0400 |
---|---|---|
committer | Igor Pashev <pashev.igor@gmail.com> | 2014-09-30 18:22:48 +0400 |
commit | c18578632fd3c9e513e613a86ba2b7c4ebee6c45 (patch) | |
tree | 377f4d4e3f0a6471a5012126078fcd97f4c67242 /lib/sig2str.c | |
parent | 974ab3dd887985e3aa347f3c6521f819296396a0 (diff) | |
download | coreutils-c18578632fd3c9e513e613a86ba2b7c4ebee6c45.tar.gz |
Imported Upstream version 8.23upstream/8.23
Diffstat (limited to 'lib/sig2str.c')
-rw-r--r-- | lib/sig2str.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/sig2str.c b/lib/sig2str.c index 8b36e2fa..119006af 100644 --- a/lib/sig2str.c +++ b/lib/sig2str.c @@ -1,6 +1,6 @@ /* sig2str.c -- convert between signal names and numbers - Copyright (C) 2002, 2004, 2006, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2002, 2004, 2006, 2009-2014 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -325,21 +325,25 @@ sig2str (int signum, char *signame) { int rtmin = SIGRTMIN; int rtmax = SIGRTMAX; + int base, delta; if (! (rtmin <= signum && signum <= rtmax)) return -1; if (signum <= rtmin + (rtmax - rtmin) / 2) { - int delta = signum - rtmin; - sprintf (signame, delta ? "RTMIN+%d" : "RTMIN", delta); + strcpy (signame, "RTMIN"); + base = rtmin; } else { - int delta = rtmax - signum; - sprintf (signame, delta ? "RTMAX-%d" : "RTMAX", delta); + strcpy (signame, "RTMAX"); + base = rtmax; } + delta = signum - base; + if (delta != 0) + sprintf (signame + 5, "%+d", delta); return 0; } } |