From 59fa2c07635be681dc26f870f992f5434387c849 Mon Sep 17 00:00:00 2001 From: sbts Date: Sun, 18 Jun 2017 22:17:01 +0800 Subject: [PATCH] implement and document additional error codes for groupmod add E_CLEANUP_SERVICE, E_PAM_USERNAME, E_PAM_ERROR to groupmod.c and groupmod.8.xml --- man/groupmod.8.xml | 15 +++++++++++++++ src/groupmod.c | 11 ++++++++--- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/man/groupmod.8.xml b/man/groupmod.8.xml index 46666252..01b22d7c 100644 --- a/man/groupmod.8.xml +++ b/man/groupmod.8.xml @@ -278,6 +278,21 @@ can't update group file + 11 + + E_CLEANUP_SERVICE: can't setup cleanup service + + + 12 + + E_PAM_USERNAME: can't determine your username for use with pam + + + 13 + + E_PAM_ERROR: pam returned an error, see syslog facility id groupmod for the PAM error message + + diff --git a/src/groupmod.c b/src/groupmod.c index 757c1a40..ae4835dd 100644 --- a/src/groupmod.c +++ b/src/groupmod.c @@ -66,6 +66,11 @@ #define E_NOTFOUND 6 /* specified group doesn't exist */ #define E_NAME_IN_USE 9 /* group name already in use */ #define E_GRP_UPDATE 10 /* can't update group file */ +#define E_CLEANUP_SERVICE 11 /* can't setup cleanup service */ +#define E_PAM_USERNAME 12 /* can't determine your username for use with pam */ +#define E_PAM_ERROR 13 /* pam returned an error, see Syslog facility id groupmod */ + + /* * Global variables */ @@ -756,7 +761,7 @@ int main (int argc, char **argv) fprintf (stderr, _("%s: Cannot setup cleanup service.\n"), Prog); - exit (1); + exit (E_CLEANUP_SERVICE); } process_flags (argc, argv); @@ -770,7 +775,7 @@ int main (int argc, char **argv) fprintf (stderr, _("%s: Cannot determine your user name.\n"), Prog); - exit (1); + exit (E_PAM_USERNAME); } retval = pam_start ("groupmod", pampw->pw_name, &conv, &pamh); @@ -791,7 +796,7 @@ int main (int argc, char **argv) if (NULL != pamh) { (void) pam_end (pamh, retval); } - exit (1); + exit (E_PAM_ERROR); } (void) pam_end (pamh, retval); #endif /* USE_PAM */