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

This commit is contained in:
sbts 2017-06-18 22:17:01 +08:00 committed by Serge Hallyn
parent 7081b2df85
commit 59fa2c0763
2 changed files with 23 additions and 3 deletions

View File

@ -278,6 +278,21 @@
<para>can't update group file</para> <para>can't update group file</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<term><replaceable>11</replaceable></term>
<listitem>
<para>E_CLEANUP_SERVICE: can't setup cleanup service</para>
</listitem>
</varlistentry>
<term><replaceable>12</replaceable></term>
<listitem>
<para>E_PAM_USERNAME: can't determine your username for use with pam</para>
</listitem>
</varlistentry>
<term><replaceable>13</replaceable></term>
<listitem>
<para>E_PAM_ERROR: pam returned an error, see syslog facility id groupmod for the PAM error message</para>
</listitem>
</varlistentry>
</variablelist> </variablelist>
</para> </para>
</refsect1> </refsect1>

View File

@ -66,6 +66,11 @@
#define E_NOTFOUND 6 /* specified group doesn't exist */ #define E_NOTFOUND 6 /* specified group doesn't exist */
#define E_NAME_IN_USE 9 /* group name already in use */ #define E_NAME_IN_USE 9 /* group name already in use */
#define E_GRP_UPDATE 10 /* can't update group file */ #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 * Global variables
*/ */
@ -756,7 +761,7 @@ int main (int argc, char **argv)
fprintf (stderr, fprintf (stderr,
_("%s: Cannot setup cleanup service.\n"), _("%s: Cannot setup cleanup service.\n"),
Prog); Prog);
exit (1); exit (E_CLEANUP_SERVICE);
} }
process_flags (argc, argv); process_flags (argc, argv);
@ -770,7 +775,7 @@ int main (int argc, char **argv)
fprintf (stderr, fprintf (stderr,
_("%s: Cannot determine your user name.\n"), _("%s: Cannot determine your user name.\n"),
Prog); Prog);
exit (1); exit (E_PAM_USERNAME);
} }
retval = pam_start ("groupmod", pampw->pw_name, &conv, &pamh); retval = pam_start ("groupmod", pampw->pw_name, &conv, &pamh);
@ -791,7 +796,7 @@ int main (int argc, char **argv)
if (NULL != pamh) { if (NULL != pamh) {
(void) pam_end (pamh, retval); (void) pam_end (pamh, retval);
} }
exit (1); exit (E_PAM_ERROR);
} }
(void) pam_end (pamh, retval); (void) pam_end (pamh, retval);
#endif /* USE_PAM */ #endif /* USE_PAM */