[Pkg-shadow-commits] r3643 - in upstream/trunk: . lib src

Nicolas FRANÇOIS nekral-guest at alioth.debian.org
Sat Nov 19 22:00:02 UTC 2011


Author: nekral-guest
Date: 2011-11-19 22:00:00 +0000 (Sat, 19 Nov 2011)
New Revision: 3643

Modified:
   upstream/trunk/ChangeLog
   upstream/trunk/lib/commonio.c
   upstream/trunk/src/passwd.c
Log:
	* 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.


Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog	2011-11-19 21:56:10 UTC (rev 3642)
+++ upstream/trunk/ChangeLog	2011-11-19 22:00:00 UTC (rev 3643)
@@ -15,6 +15,11 @@
 	* lib/selinux.c: vasprintf requires _GNU_SOURCE to be defined
 	before including stdio.h.
 	* 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 at centraliens.net>
 

Modified: upstream/trunk/lib/commonio.c
===================================================================
--- upstream/trunk/lib/commonio.c	2011-11-19 21:56:10 UTC (rev 3642)
+++ upstream/trunk/lib/commonio.c	2011-11-19 22:00:00 UTC (rev 3643)
@@ -611,7 +611,8 @@
 		return 0;
 	}
 
-	db->head = db->tail = NULL;
+	db->head = NULL;
+	db->tail = NULL;
 	db->cursor = NULL;
 	db->changed = false;
 
@@ -942,7 +943,7 @@
 	db->isopen = false;
 
 	if (!db->changed || db->readonly) {
-		fclose (db->fp);
+		(void) fclose (db->fp);
 		db->fp = NULL;
 		goto success;
 	}
@@ -954,7 +955,7 @@
 	memzero (&sb, sizeof sb);
 	if (NULL != db->fp) {
 		if (fstat (fileno (db->fp), &sb) != 0) {
-			fclose (db->fp);
+			(void) fclose (db->fp);
 			db->fp = NULL;
 			goto fail;
 		}

Modified: upstream/trunk/src/passwd.c
===================================================================
--- upstream/trunk/src/passwd.c	2011-11-19 21:56:10 UTC (rev 3642)
+++ upstream/trunk/src/passwd.c	2011-11-19 22:00:00 UTC (rev 3643)
@@ -410,9 +410,11 @@
 	 * Passwords may only be changed after sp_min time is up.
 	 */
 	if (sp->sp_lstchg > 0) {
-		time_t last, ok;
-		last = sp->sp_lstchg * SCALE;
-		ok = last + (sp->sp_min > 0 ? sp->sp_min * SCALE : 0);
+		time_t ok;
+		ok = (time_t) sp->sp_lstchg * SCALE;
+		if (sp->sp_min > 0) {
+			ok += (time_t) sp->sp_min * SCALE;
+		}
 
 		if (now < ok) {
 			(void) fprintf (stderr,




More information about the Pkg-shadow-commits mailing list