Avoid using a variable with the same name as a type.
This commit is contained in:
parent
388dcee3e4
commit
6ca79a36b0
@ -5,6 +5,7 @@
|
||||
pam API was already checked. No need to validate it again.
|
||||
* src/chage.c: main() split in new functions: process_flags(),
|
||||
check_flags(), check_perms(), open_files(), and close_files().
|
||||
* src/chage.c: Avoid using a variable with the same name as a type.
|
||||
|
||||
2007-12-28 Nicolas François <nicolas.francois@centraliens.net>
|
||||
|
||||
|
40
src/chage.c
40
src/chage.c
@ -554,7 +554,7 @@ static void close_files (void)
|
||||
int main (int argc, char **argv)
|
||||
{
|
||||
const struct spwd *sp;
|
||||
struct spwd spwd;
|
||||
struct spwd spwent;
|
||||
uid_t ruid;
|
||||
gid_t rgid;
|
||||
const struct passwd *pw;
|
||||
@ -627,20 +627,20 @@ int main (int argc, char **argv)
|
||||
* the password file.
|
||||
*/
|
||||
if (sp) {
|
||||
spwd = *sp;
|
||||
spwent = *sp;
|
||||
|
||||
if (!Mflg)
|
||||
maxdays = spwd.sp_max;
|
||||
maxdays = spwent.sp_max;
|
||||
if (!mflg)
|
||||
mindays = spwd.sp_min;
|
||||
mindays = spwent.sp_min;
|
||||
if (!dflg)
|
||||
lastday = spwd.sp_lstchg;
|
||||
lastday = spwent.sp_lstchg;
|
||||
if (!Wflg)
|
||||
warndays = spwd.sp_warn;
|
||||
warndays = spwent.sp_warn;
|
||||
if (!Iflg)
|
||||
inactdays = spwd.sp_inact;
|
||||
inactdays = spwent.sp_inact;
|
||||
if (!Eflg)
|
||||
expdays = spwd.sp_expire;
|
||||
expdays = spwent.sp_expire;
|
||||
#ifdef WITH_AUDIT
|
||||
if (Mflg)
|
||||
|
||||
@ -741,12 +741,12 @@ int main (int argc, char **argv)
|
||||
* aging information.
|
||||
*/
|
||||
if (sp == 0) {
|
||||
sp = &spwd;
|
||||
memzero (&spwd, sizeof spwd);
|
||||
sp = &spwent;
|
||||
memzero (&spwent, sizeof spwent);
|
||||
|
||||
spwd.sp_namp = xstrdup (pwent.pw_name);
|
||||
spwd.sp_pwdp = xstrdup (pwent.pw_passwd);
|
||||
spwd.sp_flag = -1;
|
||||
spwent.sp_namp = xstrdup (pwent.pw_name);
|
||||
spwent.sp_pwdp = xstrdup (pwent.pw_passwd);
|
||||
spwent.sp_flag = -1;
|
||||
|
||||
pwent.pw_passwd = SHADOW_PASSWD_STRING; /* XXX warning: const */
|
||||
if (!pw_update (&pwent)) {
|
||||
@ -768,14 +768,14 @@ int main (int argc, char **argv)
|
||||
* modified entry back to the shadow file. Closing the shadow and
|
||||
* password files will commit any changes that have been made.
|
||||
*/
|
||||
spwd.sp_max = maxdays;
|
||||
spwd.sp_min = mindays;
|
||||
spwd.sp_lstchg = lastday;
|
||||
spwd.sp_warn = warndays;
|
||||
spwd.sp_inact = inactdays;
|
||||
spwd.sp_expire = expdays;
|
||||
spwent.sp_max = maxdays;
|
||||
spwent.sp_min = mindays;
|
||||
spwent.sp_lstchg = lastday;
|
||||
spwent.sp_warn = warndays;
|
||||
spwent.sp_inact = inactdays;
|
||||
spwent.sp_expire = expdays;
|
||||
|
||||
if (!spw_update (&spwd)) {
|
||||
if (!spw_update (&spwent)) {
|
||||
fprintf (stderr,
|
||||
_("%s: can't update shadow password file\n"), Prog);
|
||||
spw_unlock ();
|
||||
|
Loading…
Reference in New Issue
Block a user