* src/passwd.c: Add missing cast.
* lib/commonio.c: Avoid multiple statements per line. * lib/commonio.c: Ignore fclose return value when the file was open read only or was not changed, or if an error is already reported.
This commit is contained in:
parent
4049c0e69e
commit
bd4a6c9966
@ -15,6 +15,11 @@
|
|||||||
* lib/selinux.c: vasprintf requires _GNU_SOURCE to be defined
|
* lib/selinux.c: vasprintf requires _GNU_SOURCE to be defined
|
||||||
before including stdio.h.
|
before including stdio.h.
|
||||||
* src/chage.c: Cast 3rd date_to_str parameter to a time_t
|
* src/chage.c: Cast 3rd date_to_str parameter to a time_t
|
||||||
|
* src/passwd.c: Add missing cast.
|
||||||
|
* lib/commonio.c: Avoid multiple statements per line.
|
||||||
|
* lib/commonio.c: Ignore fclose return value when the file was
|
||||||
|
open read only or was not changed, or if an error is already
|
||||||
|
reported.
|
||||||
|
|
||||||
2011-11-19 Nicolas François <nicolas.francois@centraliens.net>
|
2011-11-19 Nicolas François <nicolas.francois@centraliens.net>
|
||||||
|
|
||||||
|
@ -611,7 +611,8 @@ int commonio_open (struct commonio_db *db, int mode)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
db->head = db->tail = NULL;
|
db->head = NULL;
|
||||||
|
db->tail = NULL;
|
||||||
db->cursor = NULL;
|
db->cursor = NULL;
|
||||||
db->changed = false;
|
db->changed = false;
|
||||||
|
|
||||||
@ -942,7 +943,7 @@ int commonio_close (struct commonio_db *db)
|
|||||||
db->isopen = false;
|
db->isopen = false;
|
||||||
|
|
||||||
if (!db->changed || db->readonly) {
|
if (!db->changed || db->readonly) {
|
||||||
fclose (db->fp);
|
(void) fclose (db->fp);
|
||||||
db->fp = NULL;
|
db->fp = NULL;
|
||||||
goto success;
|
goto success;
|
||||||
}
|
}
|
||||||
@ -954,7 +955,7 @@ int commonio_close (struct commonio_db *db)
|
|||||||
memzero (&sb, sizeof sb);
|
memzero (&sb, sizeof sb);
|
||||||
if (NULL != db->fp) {
|
if (NULL != db->fp) {
|
||||||
if (fstat (fileno (db->fp), &sb) != 0) {
|
if (fstat (fileno (db->fp), &sb) != 0) {
|
||||||
fclose (db->fp);
|
(void) fclose (db->fp);
|
||||||
db->fp = NULL;
|
db->fp = NULL;
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
@ -410,9 +410,11 @@ static void check_password (const struct passwd *pw, const struct spwd *sp)
|
|||||||
* Passwords may only be changed after sp_min time is up.
|
* Passwords may only be changed after sp_min time is up.
|
||||||
*/
|
*/
|
||||||
if (sp->sp_lstchg > 0) {
|
if (sp->sp_lstchg > 0) {
|
||||||
time_t last, ok;
|
time_t ok;
|
||||||
last = sp->sp_lstchg * SCALE;
|
ok = (time_t) sp->sp_lstchg * SCALE;
|
||||||
ok = last + (sp->sp_min > 0 ? sp->sp_min * SCALE : 0);
|
if (sp->sp_min > 0) {
|
||||||
|
ok += (time_t) sp->sp_min * SCALE;
|
||||||
|
}
|
||||||
|
|
||||||
if (now < ok) {
|
if (now < ok) {
|
||||||
(void) fprintf (stderr,
|
(void) fprintf (stderr,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user