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

Nicolas FRANÇOIS nekral-guest at alioth.debian.org
Fri Jul 22 23:59:57 UTC 2011


Author: nekral-guest
Date: 2011-07-22 23:59:57 +0000 (Fri, 22 Jul 2011)
New Revision: 3435

Modified:
   upstream/trunk/ChangeLog
   upstream/trunk/src/faillog.c
Log:
	* src/faillog.c: Add annotations to indicate that usage() does not
	return.
	* src/faillog.c: Fix message: this is faillog, not lastlog.
	* src/faillog.c: Check that there are no extra arguments after
	parsing the options.


Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog	2011-07-22 23:52:08 UTC (rev 3434)
+++ upstream/trunk/ChangeLog	2011-07-22 23:59:57 UTC (rev 3435)
@@ -1,5 +1,13 @@
 2011-07-23  Nicolas François  <nicolas.francois at centraliens.net>
 
+	* src/faillog.c: Add annotations to indicate that usage() does not
+	return.
+	* src/faillog.c: Fix message: this is faillog, not lastlog.
+	* src/faillog.c: Check that there are no extra arguments after
+	parsing the options.
+
+2011-07-23  Nicolas François  <nicolas.francois at centraliens.net>
+
 	* src/chgpasswd.c: Add annotations to indicate that usage() does
 	not return.
 	* src/chgpasswd.c: Split usage in smaller parts. Those parts are

Modified: upstream/trunk/src/faillog.c
===================================================================
--- upstream/trunk/src/faillog.c	2011-07-22 23:52:08 UTC (rev 3434)
+++ upstream/trunk/src/faillog.c	2011-07-22 23:59:57 UTC (rev 3435)
@@ -2,7 +2,7 @@
  * Copyright (c) 1989 - 1993, Julianne Frances Haugh
  * Copyright (c) 1996 - 2000, Marek Michałkiewicz
  * Copyright (c) 2002 - 2006, Tomasz Kłoczko
- * Copyright (c) 2007 - 2010, Nicolas François
+ * Copyright (c) 2007 - 2011, Nicolas François
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -48,7 +48,7 @@
 #include "exitcodes.h"
 
 /* local function prototypes */
-static void usage (int status);
+static /*@noreturn@*/void usage (int status);
 static void print_one (/*@null@*/const struct passwd *pw, bool force);
 static void set_locktime (long locktime);
 static bool set_locktime_one (uid_t uid, long locktime);
@@ -80,7 +80,7 @@
 
 #define	NOW	(time((time_t *) 0))
 
-static void usage (int status)
+static /*@noreturn@*/void usage (int status)
 {
 	FILE *usageout = (E_SUCCESS != status) ? stderr : stdout;
 	(void) fprintf (usageout,
@@ -587,7 +587,7 @@
 				break;
 			case 'h':
 				usage (E_SUCCESS);
-				break;
+				/*@notreached@*/break;
 			case 'l':
 				if (getlong (optarg, &fail_locktime) == 0) {
 					fprintf (stderr,
@@ -643,7 +643,7 @@
 					              &umin, &has_umin,
 					              &umax, &has_umax) == 0) {
 						fprintf (stderr,
-						         _("lastlog: Unknown user or range: %s\n"),
+						         _("faillog: Unknown user or range: %s\n"),
 						         optarg);
 						exit (E_BAD_ARG);
 					}
@@ -655,6 +655,12 @@
 				usage (E_USAGE);
 			}
 		}
+		if (argc > optind) {
+			fprintf (stderr,
+			         _("faillog: unexpected argument: %s\n"),
+			         argv[optind]);
+			usage (EXIT_FAILURE);
+		}
 	}
 
 	if (tflg && (lflg || mflg || rflg)) {




More information about the Pkg-shadow-commits mailing list