X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fstrsignal.c;h=22b9065bb8a212eaccbb37af79f1ca161b2974e5;hb=f68069b334f95cfd6d18db4bb059b792beb48158;hp=ee9f7a7bd384fb43a8ec05bfb350ebc2e748ac62;hpb=60b515ecca87d870ebbb072bca366d7d1c83d5c6;p=gnulib.git diff --git a/lib/strsignal.c b/lib/strsignal.c index ee9f7a7bd..22b9065bb 100644 --- a/lib/strsignal.c +++ b/lib/strsignal.c @@ -1,4 +1,5 @@ -/* Copyright (C) 1991, 1994-2002, 2005, 2008 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1994-2002, 2005, 2008-2012 Free Software Foundation, + Inc. This file is part of the GNU C Library. This program is free software: you can redistribute it and/or modify @@ -18,10 +19,12 @@ # include #endif +/* Specification. */ +#include + #include #include #include -#include #ifdef _LIBC # include @@ -53,7 +56,9 @@ extern const char *const _sys_siglist_internal[] attribute_hidden; #else /* !_LIBC */ /* NetBSD declares sys_siglist in unistd.h. */ -# include +# if HAVE_UNISTD_H +# include +# endif # define INTUSE(x) (x) @@ -75,7 +80,7 @@ static __libc_key_t key; /* If nonzero the key allocation failed and we should better use a static buffer than fail. */ -#define BUFFERSIZ 100 +#define BUFFERSIZ 100 static char local_buf[BUFFERSIZ]; static char *static_buf; @@ -106,16 +111,16 @@ strsignal (int signum) int len; #ifdef SIGRTMIN if (signum >= SIGRTMIN && signum <= SIGRTMAX) - len = __snprintf (buffer, BUFFERSIZ - 1, _("Real-time signal %d"), - signum - SIGRTMIN); + len = __snprintf (buffer, BUFFERSIZ - 1, _("Real-time signal %d"), + signum - (int) SIGRTMIN); else #endif - len = __snprintf (buffer, BUFFERSIZ - 1, _("Unknown signal %d"), - signum); + len = __snprintf (buffer, BUFFERSIZ - 1, _("Unknown signal %d"), + signum); if (len >= BUFFERSIZ) - buffer = NULL; + buffer = NULL; else - buffer[len] = '\0'; + buffer[len] = '\0'; return buffer; } @@ -177,18 +182,18 @@ getbuffer (void) else { /* We don't use the static buffer and so we have a key. Use it - to get the thread-specific buffer. */ + to get the thread-specific buffer. */ result = __libc_getspecific (key); if (result == NULL) - { - /* No buffer allocated so far. */ - result = malloc (BUFFERSIZ); - if (result == NULL) - /* No more memory available. We use the static buffer. */ - result = local_buf; - else - __libc_setspecific (key, result); - } + { + /* No buffer allocated so far. */ + result = malloc (BUFFERSIZ); + if (result == NULL) + /* No more memory available. We use the static buffer. */ + result = local_buf; + else + __libc_setspecific (key, result); + } } return result;