Use 'void' instead of 'RETSIGTYPE'. Use 'sighandler_t' too.

C89 and POSIX.1-2001 define signal(2) as returning a pointer to a
function returning 'void'.  K&R C signal(2) signature is obsolete.
Use 'void' directly.

Also, instead of writing the function pointer type explicitly, use
POSIX's 'sighandler_t'.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
This commit is contained in:
Alejandro Colomar 2021-12-30 16:36:18 +01:00 committed by Serge Hallyn
parent 1b96f6a9b3
commit fd5945e533
7 changed files with 15 additions and 16 deletions

View File

@ -101,7 +101,6 @@ fi
dnl Checks for library functions.
AC_TYPE_GETGROUPS
AC_TYPE_SIGNAL
AC_FUNC_UTIME_NULL
AC_REPLACE_FUNCS(mkdir putgrent putpwent putspent rename rmdir)
AC_REPLACE_FUNCS(sgetgrent sgetpwent sgetspent)

View File

@ -41,9 +41,9 @@ void login_prompt (const char *prompt, char *name, int namesize)
int i;
FILE *fp;
RETSIGTYPE (*sigquit) (int);
sighandler_t sigquit;
#ifdef SIGTSTP
RETSIGTYPE (*sigtstp) (int);
sighandler_t sigtstp;
#endif
/*

View File

@ -27,14 +27,14 @@ const char *Prog;
static bool cflg = false;
/* local function prototypes */
static RETSIGTYPE catch_signals (unused int sig);
static void catch_signals (unused int sig);
static /*@noreturn@*/void usage (int status);
static void process_flags (int argc, char **argv);
/*
* catch_signals - signal catcher
*/
static RETSIGTYPE catch_signals (unused int sig)
static void catch_signals (unused int sig)
{
_exit (10);
}

View File

@ -74,7 +74,7 @@ static uid_t bywho;
/* local function prototypes */
static void usage (int status);
static RETSIGTYPE catch_signals (int killed);
static void catch_signals (int killed);
static bool is_valid_user_list (const char *users);
static void process_flags (int argc, char **argv);
static void check_flags (int argc, int opt_index);
@ -137,7 +137,7 @@ static void usage (int status)
* calls catch_signals() with a signal number, the terminal modes are
* then reset.
*/
static RETSIGTYPE catch_signals (int killed)
static void catch_signals (int killed)
{
static TERMIO sgtty;

View File

@ -124,7 +124,7 @@ static void get_pam_user (char **ptr_pam_user);
#endif
static void init_env (void);
static RETSIGTYPE alarm_handler (int);
static void alarm_handler (int);
/*
* usage - print login command usage and exit
@ -397,7 +397,7 @@ static void init_env (void)
}
static RETSIGTYPE alarm_handler (unused int sig)
static void alarm_handler (unused int sig)
{
write (STDERR_FILENO, tmsg, strlen (tmsg));
_exit (0);

View File

@ -104,10 +104,10 @@ static void execve_shell (const char *shellname,
char *args[],
char *const envp[]);
#ifdef USE_PAM
static RETSIGTYPE kill_child (int unused(s));
static void kill_child (int unused(s));
static void prepare_pam_close_session (void);
#else /* !USE_PAM */
static RETSIGTYPE die (int);
static void die (int);
static bool iswheel (const char *);
#endif /* !USE_PAM */
static bool restricted_shell (const char *shellname);
@ -130,7 +130,7 @@ static void set_environment (struct passwd *pw);
* with die() as the signal handler. If signal later calls die() with a
* signal number, the terminal modes are then reset.
*/
static RETSIGTYPE die (int killed)
static void die (int killed)
{
static TERMIO sgtty;
@ -157,7 +157,7 @@ static bool iswheel (const char *username)
return is_on_list (grp->gr_mem, username);
}
#else /* USE_PAM */
static RETSIGTYPE kill_child (int unused(s))
static void kill_child (int unused(s))
{
if (0 != pid_child) {
(void) kill (-pid_child, SIGKILL);
@ -494,7 +494,7 @@ static void check_perms_nopam (const struct passwd *pw)
{
/*@observer@*/const struct spwd *spwd = NULL;
/*@observer@*/const char *password = pw->pw_passwd;
RETSIGTYPE (*oldsig) (int);
sighandler_t oldsig;
if (caller_is_root) {
return;

View File

@ -44,9 +44,9 @@ extern char **environ;
#endif
/* local function prototypes */
static RETSIGTYPE catch_signals (int);
static void catch_signals (int);
static RETSIGTYPE catch_signals (unused int sig)
static void catch_signals (unused int sig)
{
_exit (1);
}