2009-10-14 20:04:04 +00:00
|
|
|
/*
|
2019-04-29 07:21:51 -06:00
|
|
|
* SPDX-License-Identifier: ISC
|
|
|
|
*
|
2017-12-03 17:53:40 -07:00
|
|
|
* Copyright (c) 2009-2014 Todd C. Miller <Todd.Miller@sudo.ws>
|
2009-10-14 20:04:04 +00:00
|
|
|
*
|
|
|
|
* Permission to use, copy, modify, and distribute this software for any
|
|
|
|
* purpose with or without fee is hereby granted, provided that the above
|
|
|
|
* copyright notice and this permission notice appear in all copies.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
|
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
|
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
|
|
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
|
|
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
|
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
|
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
2018-10-26 08:39:09 -06:00
|
|
|
/*
|
|
|
|
* This is an open source non-commercial project. Dear PVS-Studio, please check it.
|
|
|
|
* PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
|
|
|
|
*/
|
2018-10-21 08:46:05 -06:00
|
|
|
|
2010-08-30 09:14:41 -04:00
|
|
|
#include <config.h>
|
|
|
|
|
2013-04-01 10:19:26 -04:00
|
|
|
#ifndef HAVE_STRSIGNAL
|
|
|
|
|
2009-10-14 20:04:04 +00:00
|
|
|
#include <signal.h>
|
|
|
|
|
2023-09-25 10:13:28 -06:00
|
|
|
#include <sudo_compat.h>
|
|
|
|
#include <sudo_gettext.h>
|
2011-05-20 11:48:17 -04:00
|
|
|
|
2010-04-02 07:47:19 -04:00
|
|
|
#if defined(HAVE_DECL_SYS_SIGLIST) && HAVE_DECL_SYS_SIGLIST == 1
|
2012-08-26 20:12:51 -04:00
|
|
|
# define sudo_sys_siglist sys_siglist
|
2010-04-02 07:47:19 -04:00
|
|
|
#elif defined(HAVE_DECL__SYS_SIGLIST) && HAVE_DECL__SYS_SIGLIST == 1
|
2012-08-26 20:12:51 -04:00
|
|
|
# define sudo_sys_siglist _sys_siglist
|
2010-04-02 07:47:19 -04:00
|
|
|
#else
|
2012-08-26 20:12:51 -04:00
|
|
|
extern const char *const sudo_sys_siglist[NSIG];
|
2010-04-02 07:47:19 -04:00
|
|
|
#endif
|
|
|
|
|
2009-10-14 20:04:04 +00:00
|
|
|
/*
|
|
|
|
* Get signal description string
|
|
|
|
*/
|
|
|
|
char *
|
2014-06-26 15:51:08 -06:00
|
|
|
sudo_strsignal(int signo)
|
2009-10-14 20:04:04 +00:00
|
|
|
{
|
2012-08-28 09:40:56 -04:00
|
|
|
if (signo > 0 && signo < NSIG && sudo_sys_siglist[signo] != NULL)
|
2012-08-26 20:12:51 -04:00
|
|
|
return (char *)sudo_sys_siglist[signo];
|
2012-08-28 09:28:25 -04:00
|
|
|
/* XXX - should be "Unknown signal: %d" */
|
2022-06-29 16:41:11 -06:00
|
|
|
return (char *)_("Unknown signal");
|
2009-10-14 20:04:04 +00:00
|
|
|
}
|
2013-04-01 10:19:26 -04:00
|
|
|
#endif /* HAVE_STRSIGNAL */
|