X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=libiberty%2Fstrsignal.c;h=666b1b4f15e577ec2d18cb68fbea0c7f9777accf;hb=0ac553107c601cc9c4c340338e0fc7e0ce8375cc;hp=c3a16ab9bdcaf37997201bbebaae8fd33b830820;hpb=01f0fe5e0450edf168c1f612feb93cf588e4e7ea;p=deliverable%2Fbinutils-gdb.git diff --git a/libiberty/strsignal.c b/libiberty/strsignal.c index c3a16ab9bd..666b1b4f15 100644 --- a/libiberty/strsignal.c +++ b/libiberty/strsignal.c @@ -9,7 +9,7 @@ /* We need to declare sys_siglist, because even if the system provides it we can't assume that it is declared in (for example, SunOS provides sys_siglist, but it does not declare it in any - header file). fHowever, we can't declare sys_siglist portably, + header file). However, we can't declare sys_siglist portably, because on some systems it is declared with const and on some systems it is declared without const. If we were using autoconf, we could work out the right declaration. Until, then we just @@ -404,10 +404,10 @@ call to @code{strsignal}. #ifndef HAVE_STRSIGNAL -const char * +char * strsignal (int signo) { - const char *msg; + char *msg; static char buf[32]; #ifndef HAVE_SYS_SIGLIST @@ -428,14 +428,16 @@ strsignal (int signo) { /* In range, but no sys_siglist or no entry at this index. */ sprintf (buf, "Signal %d", signo); - msg = (const char *) buf; + msg = buf; } else { - /* In range, and a valid message. Just return the message. */ - msg = (const char *) sys_siglist[signo]; + /* In range, and a valid message. Just return the message. We + can safely cast away const, since POSIX says the user must + not modify the result. */ + msg = (char *) sys_siglist[signo]; } - + return (msg); } @@ -536,7 +538,7 @@ strtosigno (const char *name) /* -@deftypefn Supplemental void psignal (unsigned @var{signo}, char *@var{message}) +@deftypefn Supplemental void psignal (int @var{signo}, char *@var{message}) Print @var{message} to the standard error, followed by a colon, followed by the description of the signal specified by @var{signo}, @@ -549,7 +551,7 @@ followed by a newline. #ifndef HAVE_PSIGNAL void -psignal (unsigned signo, char *message) +psignal (int signo, char *message) { if (signal_names == NULL) {