* lib/utent.c (getutline): Remove getutline(). This function is
no more used. * lib/groupmem.c: Limit the scope of variable i. * lib/shadow.c: Avoid implicit conversion of pointers and integers to booleans. * lib/shadow.c: Added brackets. * libmisc/limits.c: Limit the scope of variable tmpmask. * libmisc/copydir.c: Close opened file on failure. * libmisc/loginprompt.c: Limit the scope of variable envc. * libmisc/find_new_uid.c, libmisc/find_new_gid.c: Limit the scope of variable id.
This commit is contained in:
@@ -635,6 +635,7 @@ static int copy_file (const char *src, const char *dst,
|
||||
|
||||
while ((cnt = read (ifd, buf, sizeof buf)) > 0) {
|
||||
if (write (ofd, buf, (size_t)cnt) != cnt) {
|
||||
(void) close (ifd);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ int find_new_gid (bool sys_group,
|
||||
/*@null@*/gid_t const *preferred_gid)
|
||||
{
|
||||
const struct group *grp;
|
||||
gid_t gid_min, gid_max, group_id, id;
|
||||
gid_t gid_min, gid_max, group_id;
|
||||
bool *used_gids;
|
||||
|
||||
assert (gid != NULL);
|
||||
@@ -100,6 +100,7 @@ int find_new_gid (bool sys_group,
|
||||
* some groups were created but the changes were not committed yet.
|
||||
*/
|
||||
if (sys_group) {
|
||||
gid_t id;
|
||||
/* setgrent / getgrent / endgrent can be very slow with
|
||||
* LDAP configurations (and many accounts).
|
||||
* Since there is a limited amount of IDs to be tested
|
||||
|
||||
@@ -52,7 +52,7 @@ int find_new_uid (bool sys_user,
|
||||
/*@null@*/uid_t const *preferred_uid)
|
||||
{
|
||||
const struct passwd *pwd;
|
||||
uid_t uid_min, uid_max, user_id, id;
|
||||
uid_t uid_min, uid_max, user_id;
|
||||
bool *used_uids;
|
||||
|
||||
assert (uid != NULL);
|
||||
@@ -100,6 +100,7 @@ int find_new_uid (bool sys_user,
|
||||
* some users were created but the changes were not committed yet.
|
||||
*/
|
||||
if (sys_user) {
|
||||
uid_t id;
|
||||
/* setpwent / getpwent / endpwent can be very slow with
|
||||
* LDAP configurations (and many accounts).
|
||||
* Since there is a limited amount of IDs to be tested
|
||||
|
||||
@@ -507,7 +507,6 @@ static int setup_user_limits (const char *uname)
|
||||
static void setup_usergroups (const struct passwd *info)
|
||||
{
|
||||
const struct group *grp;
|
||||
mode_t tmpmask;
|
||||
|
||||
/*
|
||||
* if not root, and UID == GID, and username is the same as primary
|
||||
@@ -519,6 +518,7 @@ static void setup_usergroups (const struct passwd *info)
|
||||
grp = getgrgid (info->pw_gid);
|
||||
if ( (NULL != grp)
|
||||
&& (strcmp (info->pw_name, grp->gr_name) == 0)) {
|
||||
mode_t tmpmask;
|
||||
tmpmask = umask (0777);
|
||||
tmpmask = (tmpmask & ~070) | ((tmpmask >> 3) & 070);
|
||||
(void) umask (tmpmask);
|
||||
|
||||
@@ -60,7 +60,6 @@ void login_prompt (const char *prompt, char *name, int namesize)
|
||||
|
||||
#define MAX_ENV 32
|
||||
char *envp[MAX_ENV];
|
||||
int envc;
|
||||
char *cp;
|
||||
int i;
|
||||
FILE *fp;
|
||||
@@ -148,6 +147,7 @@ void login_prompt (const char *prompt, char *name, int namesize)
|
||||
if ('\0' != *cp) { /* process new variables */
|
||||
char *nvar;
|
||||
int count = 1;
|
||||
int envc;
|
||||
|
||||
for (envc = 0; envc < MAX_ENV; envc++) {
|
||||
nvar = strtok ((0 != envc) ? (char *) 0 : cp, " \t,");
|
||||
|
||||
Reference in New Issue
Block a user