#ifdef HAVE_SETGROUPS
static int ngroups;
-static GETGROUPS_T *grouplist;
+static /*@null@*/ /*@only@*/GETGROUPS_T *grouplist;
#endif
static bool is_newgrp;
#ifdef WITH_AUDIT
-char audit_buf[80];
+static char audit_buf[80];
#endif
/* local function prototypes */
static void usage (void)
{
if (is_newgrp) {
- fputs (_("Usage: newgrp [-] [group]\n"), stderr);
+ (void) fputs (_("Usage: newgrp [-] [group]\n"), stderr);
} else {
- fputs (_("Usage: sg group [[-c] command]\n"), stderr);
+ (void) fputs (_("Usage: sg group [[-c] command]\n"), stderr);
}
}
* find_matching_group - search all groups of a given group id for
* membership of a given username
*/
-static struct group *find_matching_group (const char *name, gid_t gid)
+static /*@null@*/struct group *find_matching_group (const char *name, gid_t gid)
{
struct group *gr;
char **look;
SYSLOG ((LOG_INFO,
"Invalid password for group '%s' from '%s'",
groupname, pwd->pw_name));
- sleep (1);
- fputs (_("Invalid password.\n"), stderr);
+ (void) sleep (1);
+ (void) fputs (_("Invalid password.\n"), stderr);
goto failure;
}
#ifdef WITH_AUDIT
(unsigned int) getuid (), 0);
}
#endif
- exit (1);
+ exit (EXIT_FAILURE);
}
#ifdef USE_SYSLOG
(unsigned int) getuid (), 0);
}
#endif
- exit (1);
+ exit (EXIT_FAILURE);
} else if (child != 0) {
/* parent - wait for child to finish, then log session close */
int cst = 0;
(unsigned long) gid, name));
}
closelog ();
- exit (0);
+ exit (EXIT_SUCCESS);
}
/* child - restore signals to their default state */
char *command = NULL;
char **envp = environ;
struct passwd *pwd;
- struct group *grp;
+ /*@null@*/struct group *grp;
#ifdef SHADOWGRP
struct sgrp *sgrp;
SYSLOG ((LOG_WARN, "Cannot determine the user name of the caller (UID %lu)",
(unsigned long) getuid ()));
closelog ();
- exit (1);
+ exit (EXIT_FAILURE);
}
name = pwd->pw_name;
} else {
usage ();
closelog ();
- exit (1);
+ exit (EXIT_FAILURE);
}
if (argc > 0) {
(unsigned int) getuid (), 0);
}
#endif
- exit (1);
+ exit (EXIT_FAILURE);
}
#endif /* HAVE_SETGROUPS */
}
if (i == ngroups) {
if (ngroups >= sysconf (_SC_NGROUPS_MAX)) {
- fputs (_("too many groups\n"), stderr);
+ (void) fputs (_("too many groups\n"), stderr);
} else {
grouplist[ngroups++] = gid;
if (setgroups (ngroups, grouplist) != 0) {
audit_buf, NULL,
(unsigned int) getuid (), 0);
#endif
- exit (1);
+ exit (EXIT_FAILURE);
}
if (setuid (getuid ()) != 0) {
audit_buf, NULL,
(unsigned int) getuid (), 0);
#endif
- exit (1);
+ exit (EXIT_FAILURE);
}
/*
*/
err = shell (prog, initflag ? (char *) 0 : cp, newenvp);
exit (err == ENOENT ? E_CMD_NOTFOUND : E_CMD_NOEXEC);
- /* NOTREACHED */
+ /* @notreached@ */
failure:
/*
(unsigned int) getuid (), 0);
}
#endif
- exit (1);
+ exit (EXIT_FAILURE);
}