From 35edae5892eabfefa0bb485a7a431bd0c938395a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= Date: Thu, 26 Jan 2023 22:08:43 +0100 Subject: [PATCH] Declare usage and failure handler noreturn Assist static analyzers in understanding final code paths. --- src/chgpasswd.c | 2 +- src/groupmems.c | 2 +- src/su.c | 1 + src/useradd.c | 4 ++-- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/chgpasswd.c b/src/chgpasswd.c index 7b773e2f..d7cdd76a 100644 --- a/src/chgpasswd.c +++ b/src/chgpasswd.c @@ -62,7 +62,7 @@ static bool sgr_locked = false; static bool gr_locked = false; /* local function prototypes */ -static void fail_exit (int code); +NORETURN static void fail_exit (int code); NORETURN static void usage (int status); static void process_flags (int argc, char **argv); static void check_flags (void); diff --git a/src/groupmems.c b/src/groupmems.c index 1ac937ea..63a1601c 100644 --- a/src/groupmems.c +++ b/src/groupmems.c @@ -71,7 +71,7 @@ static void display_members (const char *const *members); NORETURN static void usage (int status); static void process_flags (int argc, char **argv); static void check_perms (void); -static void fail_exit (int code); +NORETURN static void fail_exit (int code); #define isroot() (getuid () == 0) static char *whoami (void) diff --git a/src/su.c b/src/su.c index b0334413..d8a20857 100644 --- a/src/su.c +++ b/src/su.c @@ -433,6 +433,7 @@ static void prepare_pam_close_session (void) /* * usage - print command line syntax and exit */ +NORETURN static void usage (int status) { (void) diff --git a/src/useradd.c b/src/useradd.c index a6909927..11d0bc9c 100644 --- a/src/useradd.c +++ b/src/useradd.c @@ -205,13 +205,13 @@ static bool home_added = false; #define DLOG_INIT "LOG_INIT=" /* local function prototypes */ -static void fail_exit (int); +NORETURN static void fail_exit (int); static void get_defaults (void); static void show_defaults (void); static int set_defaults (void); static int get_groups (char *); static struct group * get_local_group (char * grp_name); -static void usage (int status); +NORETURN static void usage (int status); static void new_pwent (struct passwd *); static long scale_age (long);