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.
|
pam API was already checked. No need to validate it again.
|
||||||
* src/chage.c: main() split in new functions: process_flags(),
|
* src/chage.c: main() split in new functions: process_flags(),
|
||||||
check_flags(), check_perms(), open_files(), and close_files().
|
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>
|
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)
|
int main (int argc, char **argv)
|
||||||
{
|
{
|
||||||
const struct spwd *sp;
|
const struct spwd *sp;
|
||||||
struct spwd spwd;
|
struct spwd spwent;
|
||||||
uid_t ruid;
|
uid_t ruid;
|
||||||
gid_t rgid;
|
gid_t rgid;
|
||||||
const struct passwd *pw;
|
const struct passwd *pw;
|
||||||
@ -627,20 +627,20 @@ int main (int argc, char **argv)
|
|||||||
* the password file.
|
* the password file.
|
||||||
*/
|
*/
|
||||||
if (sp) {
|
if (sp) {
|
||||||
spwd = *sp;
|
spwent = *sp;
|
||||||
|
|
||||||
if (!Mflg)
|
if (!Mflg)
|
||||||
maxdays = spwd.sp_max;
|
maxdays = spwent.sp_max;
|
||||||
if (!mflg)
|
if (!mflg)
|
||||||
mindays = spwd.sp_min;
|
mindays = spwent.sp_min;
|
||||||
if (!dflg)
|
if (!dflg)
|
||||||
lastday = spwd.sp_lstchg;
|
lastday = spwent.sp_lstchg;
|
||||||
if (!Wflg)
|
if (!Wflg)
|
||||||
warndays = spwd.sp_warn;
|
warndays = spwent.sp_warn;
|
||||||
if (!Iflg)
|
if (!Iflg)
|
||||||
inactdays = spwd.sp_inact;
|
inactdays = spwent.sp_inact;
|
||||||
if (!Eflg)
|
if (!Eflg)
|
||||||
expdays = spwd.sp_expire;
|
expdays = spwent.sp_expire;
|
||||||
#ifdef WITH_AUDIT
|
#ifdef WITH_AUDIT
|
||||||
if (Mflg)
|
if (Mflg)
|
||||||
|
|
||||||
@ -741,12 +741,12 @@ int main (int argc, char **argv)
|
|||||||
* aging information.
|
* aging information.
|
||||||
*/
|
*/
|
||||||
if (sp == 0) {
|
if (sp == 0) {
|
||||||
sp = &spwd;
|
sp = &spwent;
|
||||||
memzero (&spwd, sizeof spwd);
|
memzero (&spwent, sizeof spwent);
|
||||||
|
|
||||||
spwd.sp_namp = xstrdup (pwent.pw_name);
|
spwent.sp_namp = xstrdup (pwent.pw_name);
|
||||||
spwd.sp_pwdp = xstrdup (pwent.pw_passwd);
|
spwent.sp_pwdp = xstrdup (pwent.pw_passwd);
|
||||||
spwd.sp_flag = -1;
|
spwent.sp_flag = -1;
|
||||||
|
|
||||||
pwent.pw_passwd = SHADOW_PASSWD_STRING; /* XXX warning: const */
|
pwent.pw_passwd = SHADOW_PASSWD_STRING; /* XXX warning: const */
|
||||||
if (!pw_update (&pwent)) {
|
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
|
* modified entry back to the shadow file. Closing the shadow and
|
||||||
* password files will commit any changes that have been made.
|
* password files will commit any changes that have been made.
|
||||||
*/
|
*/
|
||||||
spwd.sp_max = maxdays;
|
spwent.sp_max = maxdays;
|
||||||
spwd.sp_min = mindays;
|
spwent.sp_min = mindays;
|
||||||
spwd.sp_lstchg = lastday;
|
spwent.sp_lstchg = lastday;
|
||||||
spwd.sp_warn = warndays;
|
spwent.sp_warn = warndays;
|
||||||
spwd.sp_inact = inactdays;
|
spwent.sp_inact = inactdays;
|
||||||
spwd.sp_expire = expdays;
|
spwent.sp_expire = expdays;
|
||||||
|
|
||||||
if (!spw_update (&spwd)) {
|
if (!spw_update (&spwent)) {
|
||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
_("%s: can't update shadow password file\n"), Prog);
|
_("%s: can't update shadow password file\n"), Prog);
|
||||||
spw_unlock ();
|
spw_unlock ();
|
||||||
|
Loading…
Reference in New Issue
Block a user