Use the noreturn attribute, rather than comments
This will allow the compiler to understand these functions better. Signed-off-by: Alejandro Colomar <alx@kernel.org>
This commit is contained in:
parent
b34387745a
commit
416707b087
12
src/chage.c
12
src/chage.c
@ -66,7 +66,7 @@ static long inactdays;
|
|||||||
static long expdate;
|
static long expdate;
|
||||||
|
|
||||||
/* local function prototypes */
|
/* local function prototypes */
|
||||||
static /*@noreturn@*/void usage (int status);
|
NORETURN static void usage (int status);
|
||||||
static int new_fields (void);
|
static int new_fields (void);
|
||||||
static void print_date (time_t date);
|
static void print_date (time_t date);
|
||||||
static void list_fields (void);
|
static void list_fields (void);
|
||||||
@ -75,12 +75,14 @@ static void check_flags (int argc, int opt_index);
|
|||||||
static void check_perms (void);
|
static void check_perms (void);
|
||||||
static void open_files (bool readonly);
|
static void open_files (bool readonly);
|
||||||
static void close_files (void);
|
static void close_files (void);
|
||||||
static /*@noreturn@*/void fail_exit (int code);
|
NORETURN static void fail_exit (int code);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* fail_exit - do some cleanup and exit with the given error code
|
* fail_exit - do some cleanup and exit with the given error code
|
||||||
*/
|
*/
|
||||||
static /*@noreturn@*/void fail_exit (int code)
|
NORETURN
|
||||||
|
static void
|
||||||
|
fail_exit (int code)
|
||||||
{
|
{
|
||||||
if (spw_locked) {
|
if (spw_locked) {
|
||||||
if (spw_unlock () == 0) {
|
if (spw_unlock () == 0) {
|
||||||
@ -112,7 +114,9 @@ static /*@noreturn@*/void fail_exit (int code)
|
|||||||
/*
|
/*
|
||||||
* usage - print command line syntax and exit
|
* usage - print command line syntax and exit
|
||||||
*/
|
*/
|
||||||
static /*@noreturn@*/void usage (int status)
|
NORETURN
|
||||||
|
static void
|
||||||
|
usage (int status)
|
||||||
{
|
{
|
||||||
FILE *usageout = (E_SUCCESS != status) ? stderr : stdout;
|
FILE *usageout = (E_SUCCESS != status) ? stderr : stdout;
|
||||||
(void) fprintf (usageout,
|
(void) fprintf (usageout,
|
||||||
|
@ -55,7 +55,7 @@ static bool pw_locked = false;
|
|||||||
|
|
||||||
/* local function prototypes */
|
/* local function prototypes */
|
||||||
static void fail_exit (int code);
|
static void fail_exit (int code);
|
||||||
static /*@noreturn@*/void usage (int status);
|
NORETURN static void usage (int status);
|
||||||
static bool may_change_field (int);
|
static bool may_change_field (int);
|
||||||
static void new_fields (void);
|
static void new_fields (void);
|
||||||
static char *copy_field (char *, char *, char *);
|
static char *copy_field (char *, char *, char *);
|
||||||
@ -86,7 +86,9 @@ static void fail_exit (int code)
|
|||||||
/*
|
/*
|
||||||
* usage - print command line syntax and exit
|
* usage - print command line syntax and exit
|
||||||
*/
|
*/
|
||||||
static /*@noreturn@*/void usage (int status)
|
NORETURN
|
||||||
|
static void
|
||||||
|
usage (int status)
|
||||||
{
|
{
|
||||||
FILE *usageout = (E_SUCCESS != status) ? stderr : stdout;
|
FILE *usageout = (E_SUCCESS != status) ? stderr : stdout;
|
||||||
(void) fprintf (usageout,
|
(void) fprintf (usageout,
|
||||||
|
@ -63,7 +63,7 @@ static bool gr_locked = false;
|
|||||||
|
|
||||||
/* local function prototypes */
|
/* local function prototypes */
|
||||||
static void fail_exit (int code);
|
static void fail_exit (int code);
|
||||||
static /*@noreturn@*/void usage (int status);
|
NORETURN static void usage (int status);
|
||||||
static void process_flags (int argc, char **argv);
|
static void process_flags (int argc, char **argv);
|
||||||
static void check_flags (void);
|
static void check_flags (void);
|
||||||
static void check_perms (void);
|
static void check_perms (void);
|
||||||
@ -99,7 +99,9 @@ static void fail_exit (int code)
|
|||||||
/*
|
/*
|
||||||
* usage - display usage message and exit
|
* usage - display usage message and exit
|
||||||
*/
|
*/
|
||||||
static /*@noreturn@*/void usage (int status)
|
NORETURN
|
||||||
|
static void
|
||||||
|
usage (int status)
|
||||||
{
|
{
|
||||||
FILE *usageout = (E_SUCCESS != status) ? stderr : stdout;
|
FILE *usageout = (E_SUCCESS != status) ? stderr : stdout;
|
||||||
(void) fprintf (usageout,
|
(void) fprintf (usageout,
|
||||||
|
@ -60,7 +60,7 @@ static bool spw_locked = false;
|
|||||||
|
|
||||||
/* local function prototypes */
|
/* local function prototypes */
|
||||||
static void fail_exit (int code);
|
static void fail_exit (int code);
|
||||||
static /*@noreturn@*/void usage (int status);
|
NORETURN static void usage (int status);
|
||||||
static void process_flags (int argc, char **argv);
|
static void process_flags (int argc, char **argv);
|
||||||
static void check_flags (void);
|
static void check_flags (void);
|
||||||
static void check_perms (void);
|
static void check_perms (void);
|
||||||
@ -94,7 +94,9 @@ static void fail_exit (int code)
|
|||||||
/*
|
/*
|
||||||
* usage - display usage message and exit
|
* usage - display usage message and exit
|
||||||
*/
|
*/
|
||||||
static /*@noreturn@*/void usage (int status)
|
NORETURN
|
||||||
|
static void
|
||||||
|
usage (int status)
|
||||||
{
|
{
|
||||||
FILE *usageout = (E_SUCCESS != status) ? stderr : stdout;
|
FILE *usageout = (E_SUCCESS != status) ? stderr : stdout;
|
||||||
(void) fprintf (usageout,
|
(void) fprintf (usageout,
|
||||||
|
12
src/chsh.c
12
src/chsh.c
@ -53,8 +53,8 @@ static bool pw_locked = false;
|
|||||||
/* external identifiers */
|
/* external identifiers */
|
||||||
|
|
||||||
/* local function prototypes */
|
/* local function prototypes */
|
||||||
static /*@noreturn@*/void fail_exit (int code);
|
NORETURN static void fail_exit (int code);
|
||||||
static /*@noreturn@*/void usage (int status);
|
NORETURN static void usage (int status);
|
||||||
static void new_fields (void);
|
static void new_fields (void);
|
||||||
static bool shell_is_listed (const char *);
|
static bool shell_is_listed (const char *);
|
||||||
static bool is_restricted_shell (const char *);
|
static bool is_restricted_shell (const char *);
|
||||||
@ -65,7 +65,9 @@ static void update_shell (const char *user, char *loginsh);
|
|||||||
/*
|
/*
|
||||||
* fail_exit - do some cleanup and exit with the given error code
|
* fail_exit - do some cleanup and exit with the given error code
|
||||||
*/
|
*/
|
||||||
static /*@noreturn@*/void fail_exit (int code)
|
NORETURN
|
||||||
|
static void
|
||||||
|
fail_exit (int code)
|
||||||
{
|
{
|
||||||
if (pw_locked) {
|
if (pw_locked) {
|
||||||
if (pw_unlock () == 0) {
|
if (pw_unlock () == 0) {
|
||||||
@ -83,7 +85,9 @@ static /*@noreturn@*/void fail_exit (int code)
|
|||||||
/*
|
/*
|
||||||
* usage - print command line syntax and exit
|
* usage - print command line syntax and exit
|
||||||
*/
|
*/
|
||||||
static /*@noreturn@*/void usage (int status)
|
NORETURN
|
||||||
|
static void
|
||||||
|
usage (int status)
|
||||||
{
|
{
|
||||||
FILE *usageout = (E_SUCCESS != status) ? stderr : stdout;
|
FILE *usageout = (E_SUCCESS != status) ? stderr : stdout;
|
||||||
(void) fprintf (usageout,
|
(void) fprintf (usageout,
|
||||||
|
@ -28,7 +28,7 @@ static bool cflg = false;
|
|||||||
|
|
||||||
/* local function prototypes */
|
/* local function prototypes */
|
||||||
static void catch_signals (unused int sig);
|
static void catch_signals (unused int sig);
|
||||||
static /*@noreturn@*/void usage (int status);
|
NORETURN static void usage (int status);
|
||||||
static void process_flags (int argc, char **argv);
|
static void process_flags (int argc, char **argv);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -42,7 +42,9 @@ static void catch_signals (unused int sig)
|
|||||||
/*
|
/*
|
||||||
* usage - print syntax message and exit
|
* usage - print syntax message and exit
|
||||||
*/
|
*/
|
||||||
static /*@noreturn@*/void usage (int status)
|
NORETURN
|
||||||
|
static void
|
||||||
|
usage (int status)
|
||||||
{
|
{
|
||||||
FILE *usageout = (E_SUCCESS != status) ? stderr : stdout;
|
FILE *usageout = (E_SUCCESS != status) ? stderr : stdout;
|
||||||
(void) fprintf (usageout,
|
(void) fprintf (usageout,
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
#include "shadowlog.h"
|
#include "shadowlog.h"
|
||||||
|
|
||||||
/* local function prototypes */
|
/* local function prototypes */
|
||||||
static /*@noreturn@*/void usage (int status);
|
NORETURN static void usage (int status);
|
||||||
static void print_one (/*@null@*/const struct passwd *pw, bool force);
|
static void print_one (/*@null@*/const struct passwd *pw, bool force);
|
||||||
static void set_locktime (long locktime);
|
static void set_locktime (long locktime);
|
||||||
static bool set_locktime_one (uid_t uid, long locktime);
|
static bool set_locktime_one (uid_t uid, long locktime);
|
||||||
@ -59,7 +59,9 @@ static struct stat statbuf; /* fstat buffer for file size */
|
|||||||
|
|
||||||
#define NOW time(NULL)
|
#define NOW time(NULL)
|
||||||
|
|
||||||
static /*@noreturn@*/void usage (int status)
|
NORETURN
|
||||||
|
static void
|
||||||
|
usage (int status)
|
||||||
{
|
{
|
||||||
FILE *usageout = (E_SUCCESS != status) ? stderr : stdout;
|
FILE *usageout = (E_SUCCESS != status) ? stderr : stdout;
|
||||||
(void) fprintf (usageout,
|
(void) fprintf (usageout,
|
||||||
|
@ -70,7 +70,7 @@ static bool is_shadow_grp;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* local function prototypes */
|
/* local function prototypes */
|
||||||
static /*@noreturn@*/void usage (int status);
|
NORETURN static void usage (int status);
|
||||||
static void new_grent (struct group *grent);
|
static void new_grent (struct group *grent);
|
||||||
|
|
||||||
#ifdef SHADOWGRP
|
#ifdef SHADOWGRP
|
||||||
@ -87,7 +87,9 @@ static void check_perms (void);
|
|||||||
/*
|
/*
|
||||||
* usage - display usage message and exit
|
* usage - display usage message and exit
|
||||||
*/
|
*/
|
||||||
static /*@noreturn@*/void usage (int status)
|
NORETURN
|
||||||
|
static void
|
||||||
|
usage (int status)
|
||||||
{
|
{
|
||||||
FILE *usageout = (E_SUCCESS != status) ? stderr : stdout;
|
FILE *usageout = (E_SUCCESS != status) ? stderr : stdout;
|
||||||
(void) fprintf (usageout,
|
(void) fprintf (usageout,
|
||||||
|
@ -58,7 +58,7 @@ static bool is_shadow_grp;
|
|||||||
#define E_GRP_UPDATE 10 /* can't update group file */
|
#define E_GRP_UPDATE 10 /* can't update group file */
|
||||||
|
|
||||||
/* local function prototypes */
|
/* local function prototypes */
|
||||||
static /*@noreturn@*/void usage (int status);
|
NORETURN static void usage (int status);
|
||||||
static void grp_update (void);
|
static void grp_update (void);
|
||||||
static void close_files (void);
|
static void close_files (void);
|
||||||
static void open_files (void);
|
static void open_files (void);
|
||||||
@ -68,7 +68,9 @@ static void process_flags (int argc, char **argv);
|
|||||||
/*
|
/*
|
||||||
* usage - display usage message and exit
|
* usage - display usage message and exit
|
||||||
*/
|
*/
|
||||||
static /*@noreturn@*/void usage (int status)
|
NORETURN
|
||||||
|
static void
|
||||||
|
usage (int status)
|
||||||
{
|
{
|
||||||
FILE *usageout = (E_SUCCESS != status) ? stderr : stdout;
|
FILE *usageout = (E_SUCCESS != status) ? stderr : stdout;
|
||||||
(void) fprintf (usageout,
|
(void) fprintf (usageout,
|
||||||
|
@ -66,7 +66,7 @@ static void remove_user (const char *user,
|
|||||||
const struct group *grp);
|
const struct group *grp);
|
||||||
static void purge_members (const struct group *grp);
|
static void purge_members (const struct group *grp);
|
||||||
static void display_members (const char *const *members);
|
static void display_members (const char *const *members);
|
||||||
static /*@noreturn@*/void usage (int status);
|
NORETURN static void usage (int status);
|
||||||
static void process_flags (int argc, char **argv);
|
static void process_flags (int argc, char **argv);
|
||||||
static void check_perms (void);
|
static void check_perms (void);
|
||||||
static void fail_exit (int code);
|
static void fail_exit (int code);
|
||||||
@ -339,7 +339,9 @@ static void display_members (const char *const *members)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static /*@noreturn@*/void usage (int status)
|
NORETURN
|
||||||
|
static void
|
||||||
|
usage (int status)
|
||||||
{
|
{
|
||||||
FILE *usageout = (EXIT_SUCCESS != status) ? stderr : stdout;
|
FILE *usageout = (EXIT_SUCCESS != status) ? stderr : stdout;
|
||||||
(void) fprintf (usageout,
|
(void) fprintf (usageout,
|
||||||
|
@ -62,7 +62,7 @@ static bool silence_warnings = false;
|
|||||||
|
|
||||||
/* local function prototypes */
|
/* local function prototypes */
|
||||||
static void fail_exit (int status);
|
static void fail_exit (int status);
|
||||||
static /*@noreturn@*/void usage (int status);
|
NORETURN static void usage (int status);
|
||||||
static void delete_member (char **, const char *);
|
static void delete_member (char **, const char *);
|
||||||
static void process_flags (int argc, char **argv);
|
static void process_flags (int argc, char **argv);
|
||||||
static void open_files (void);
|
static void open_files (void);
|
||||||
@ -114,7 +114,9 @@ static void fail_exit (int status)
|
|||||||
/*
|
/*
|
||||||
* usage - print syntax message and exit
|
* usage - print syntax message and exit
|
||||||
*/
|
*/
|
||||||
static /*@noreturn@*/void usage (int status)
|
NORETURN
|
||||||
|
static void
|
||||||
|
usage (int status)
|
||||||
{
|
{
|
||||||
FILE *usageout = (E_SUCCESS != status) ? stderr : stdout;
|
FILE *usageout = (E_SUCCESS != status) ? stderr : stdout;
|
||||||
#ifdef SHADOWGRP
|
#ifdef SHADOWGRP
|
||||||
|
@ -58,7 +58,9 @@ static bool Sflg = false; /* set record for user */
|
|||||||
|
|
||||||
#define NOW time(NULL)
|
#define NOW time(NULL)
|
||||||
|
|
||||||
static /*@noreturn@*/void usage (int status)
|
NORETURN
|
||||||
|
static void
|
||||||
|
usage (int status)
|
||||||
{
|
{
|
||||||
FILE *usageout = (E_SUCCESS != status) ? stderr : stdout;
|
FILE *usageout = (E_SUCCESS != status) ? stderr : stdout;
|
||||||
(void) fprintf (usageout,
|
(void) fprintf (usageout,
|
||||||
|
18
src/passwd.c
18
src/passwd.c
@ -104,7 +104,7 @@ static bool do_update_pwd = false;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* local function prototypes */
|
/* local function prototypes */
|
||||||
static /*@noreturn@*/void usage (int);
|
NORETURN static void usage (int);
|
||||||
|
|
||||||
#ifndef USE_PAM
|
#ifndef USE_PAM
|
||||||
static bool reuse (const char *, const struct passwd *);
|
static bool reuse (const char *, const struct passwd *);
|
||||||
@ -114,8 +114,8 @@ static void check_password (const struct passwd *, const struct spwd *);
|
|||||||
#endif /* !USE_PAM */
|
#endif /* !USE_PAM */
|
||||||
static /*@observer@*/const char *pw_status (const char *);
|
static /*@observer@*/const char *pw_status (const char *);
|
||||||
static void print_status (const struct passwd *);
|
static void print_status (const struct passwd *);
|
||||||
static /*@noreturn@*/void fail_exit (int);
|
NORETURN static void fail_exit (int);
|
||||||
static /*@noreturn@*/void oom (void);
|
NORETURN static void oom (void);
|
||||||
static char *update_crypt_pw (char *);
|
static char *update_crypt_pw (char *);
|
||||||
static void update_noshadow (void);
|
static void update_noshadow (void);
|
||||||
|
|
||||||
@ -124,7 +124,9 @@ static void update_shadow (void);
|
|||||||
/*
|
/*
|
||||||
* usage - print command usage and exit
|
* usage - print command usage and exit
|
||||||
*/
|
*/
|
||||||
static /*@noreturn@*/void usage (int status)
|
NORETURN
|
||||||
|
static void
|
||||||
|
usage (int status)
|
||||||
{
|
{
|
||||||
FILE *usageout = (E_SUCCESS != status) ? stderr : stdout;
|
FILE *usageout = (E_SUCCESS != status) ? stderr : stdout;
|
||||||
(void) fprintf (usageout,
|
(void) fprintf (usageout,
|
||||||
@ -466,7 +468,9 @@ static void print_status (const struct passwd *pw)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static /*@noreturn@*/void fail_exit (int status)
|
NORETURN
|
||||||
|
static void
|
||||||
|
fail_exit (int status)
|
||||||
{
|
{
|
||||||
if (pw_locked) {
|
if (pw_locked) {
|
||||||
if (pw_unlock () == 0) {
|
if (pw_unlock () == 0) {
|
||||||
@ -487,7 +491,9 @@ static /*@noreturn@*/void fail_exit (int status)
|
|||||||
exit (status);
|
exit (status);
|
||||||
}
|
}
|
||||||
|
|
||||||
static /*@noreturn@*/void oom (void)
|
NORETURN
|
||||||
|
static void
|
||||||
|
oom (void)
|
||||||
{
|
{
|
||||||
(void) fprintf (stderr, _("%s: out of memory\n"), Prog);
|
(void) fprintf (stderr, _("%s: out of memory\n"), Prog);
|
||||||
fail_exit (E_FAILURE);
|
fail_exit (E_FAILURE);
|
||||||
|
@ -66,7 +66,7 @@ static bool quiet = false; /* don't report warnings, only errors */
|
|||||||
|
|
||||||
/* local function prototypes */
|
/* local function prototypes */
|
||||||
static void fail_exit (int code);
|
static void fail_exit (int code);
|
||||||
static /*@noreturn@*/void usage (int status);
|
NORETURN static void usage (int status);
|
||||||
static void process_flags (int argc, char **argv);
|
static void process_flags (int argc, char **argv);
|
||||||
static void open_files (void);
|
static void open_files (void);
|
||||||
static void close_files (bool changed);
|
static void close_files (bool changed);
|
||||||
@ -109,7 +109,9 @@ static void fail_exit (int code)
|
|||||||
/*
|
/*
|
||||||
* usage - print syntax message and exit
|
* usage - print syntax message and exit
|
||||||
*/
|
*/
|
||||||
static /*@noreturn@*/void usage (int status)
|
NORETURN
|
||||||
|
static void
|
||||||
|
usage (int status)
|
||||||
{
|
{
|
||||||
FILE *usageout = (E_SUCCESS != status) ? stderr : stdout;
|
FILE *usageout = (E_SUCCESS != status) ? stderr : stdout;
|
||||||
#ifdef WITH_TCB
|
#ifdef WITH_TCB
|
||||||
|
6
src/su.c
6
src/su.c
@ -111,7 +111,7 @@ static void die (int);
|
|||||||
static bool iswheel (const char *);
|
static bool iswheel (const char *);
|
||||||
#endif /* !USE_PAM */
|
#endif /* !USE_PAM */
|
||||||
static bool restricted_shell (const char *shellname);
|
static bool restricted_shell (const char *shellname);
|
||||||
static /*@noreturn@*/void su_failure (const char *tty, bool su_to_root);
|
NORETURN static void su_failure (const char *tty, bool su_to_root);
|
||||||
static /*@only@*/struct passwd * check_perms (void);
|
static /*@only@*/struct passwd * check_perms (void);
|
||||||
#ifdef USE_PAM
|
#ifdef USE_PAM
|
||||||
static void check_perms_pam (const struct passwd *pw);
|
static void check_perms_pam (const struct passwd *pw);
|
||||||
@ -185,7 +185,9 @@ static bool restricted_shell (const char *shellname)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static /*@noreturn@*/void su_failure (const char *tty, bool su_to_root)
|
NORETURN
|
||||||
|
static void
|
||||||
|
su_failure (const char *tty, bool su_to_root)
|
||||||
{
|
{
|
||||||
sulog (tty, false, caller_name, name); /* log failed attempt */
|
sulog (tty, false, caller_name, name); /* log failed attempt */
|
||||||
if (getdef_bool ("SYSLOG_SU_ENAB")) {
|
if (getdef_bool ("SYSLOG_SU_ENAB")) {
|
||||||
|
@ -163,10 +163,10 @@ static bool sub_gid_locked = false;
|
|||||||
|
|
||||||
/* local function prototypes */
|
/* local function prototypes */
|
||||||
static int get_groups (char *);
|
static int get_groups (char *);
|
||||||
static /*@noreturn@*/void usage (int status);
|
NORETURN static void usage (int status);
|
||||||
static void new_pwent (struct passwd *);
|
static void new_pwent (struct passwd *);
|
||||||
static void new_spent (struct spwd *);
|
static void new_spent (struct spwd *);
|
||||||
static /*@noreturn@*/void fail_exit (int);
|
NORETURN static void fail_exit (int);
|
||||||
static void update_group (void);
|
static void update_group (void);
|
||||||
|
|
||||||
#ifdef SHADOWGRP
|
#ifdef SHADOWGRP
|
||||||
@ -359,7 +359,9 @@ static int prepend_range(const char *str, struct ulong_range_list_entry **head)
|
|||||||
/*
|
/*
|
||||||
* usage - display usage message and exit
|
* usage - display usage message and exit
|
||||||
*/
|
*/
|
||||||
static /*@noreturn@*/void usage (int status)
|
NORETURN
|
||||||
|
static void
|
||||||
|
usage (int status)
|
||||||
{
|
{
|
||||||
FILE *usageout = (E_SUCCESS != status) ? stderr : stdout;
|
FILE *usageout = (E_SUCCESS != status) ? stderr : stdout;
|
||||||
(void) fprintf (usageout,
|
(void) fprintf (usageout,
|
||||||
@ -627,7 +629,9 @@ static void new_spent (struct spwd *spent)
|
|||||||
/*
|
/*
|
||||||
* fail_exit - exit with an error code after unlocking files
|
* fail_exit - exit with an error code after unlocking files
|
||||||
*/
|
*/
|
||||||
static /*@noreturn@*/void fail_exit (int code)
|
NORETURN
|
||||||
|
static void
|
||||||
|
fail_exit (int code)
|
||||||
{
|
{
|
||||||
if (gr_locked) {
|
if (gr_locked) {
|
||||||
if (gr_unlock () == 0) {
|
if (gr_unlock () == 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user