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

Nicolas FRANÇOIS nekral-guest at alioth.debian.org
Tue Oct 18 20:23:34 UTC 2011


Author: nekral-guest
Date: 2011-10-18 20:23:33 +0000 (Tue, 18 Oct 2011)
New Revision: 3520

Modified:
   upstream/trunk/ChangeLog
   upstream/trunk/lib/prototypes.h
   upstream/trunk/lib/spawn.c
   upstream/trunk/libmisc/cleanup.c
   upstream/trunk/src/chage.c
Log:
	* lib/prototypes.h, libmisc/cleanup.c, lib/spawn.c, src/chage.c:
	Add splint annotations.


Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog	2011-10-18 20:16:00 UTC (rev 3519)
+++ upstream/trunk/ChangeLog	2011-10-18 20:23:33 UTC (rev 3520)
@@ -3,6 +3,8 @@
 	* src/newusers.c: Fix typo.
 	* src/useradd.c: Likewise.
 	* lib/nscd.c: Remove unused variable.
+	* lib/prototypes.h, libmisc/cleanup.c, lib/spawn.c, src/chage.c:
+	Add splint annotations.
 
 2011-10-15  Nicolas François  <nicolas.francois at centraliens.net>
 

Modified: upstream/trunk/lib/prototypes.h
===================================================================
--- upstream/trunk/lib/prototypes.h	2011-10-18 20:16:00 UTC (rev 3519)
+++ upstream/trunk/lib/prototypes.h	2011-10-18 20:23:33 UTC (rev 3520)
@@ -83,9 +83,9 @@
 extern void chown_tty (const struct passwd *);
 
 /* cleanup.c */
-typedef void (*cleanup_function) (/*@null@*/void *arg);
-void add_cleanup (cleanup_function pcf, /*@null@*/void *arg);
-void del_cleanup (cleanup_function pcf);
+typedef /*@null@*/void (*cleanup_function) (/*@null@*/void *arg);
+void add_cleanup (/*@notnull@*/cleanup_function pcf, /*@null@*/void *arg);
+void del_cleanup (/*@notnull@*/cleanup_function pcf);
 void do_cleanups (void);
 
 /* cleanup_group.c */
@@ -340,7 +340,7 @@
 
 /* spawn.c */
 extern int run_command (const char *cmd, const char *argv[],
-                        const char *envp[], int *status);
+                        /*@null@*/const char *envp[], /*@out@*/int *status);
 
 /* system.c */
 extern int safe_system (const char *command,

Modified: upstream/trunk/lib/spawn.c
===================================================================
--- upstream/trunk/lib/spawn.c	2011-10-18 20:16:00 UTC (rev 3519)
+++ upstream/trunk/lib/spawn.c	2011-10-18 20:23:33 UTC (rev 3520)
@@ -38,8 +38,8 @@
 #include "exitcodes.h"
 #include "prototypes.h"
 
-int run_command (const char *cmd, const char *argv[], const char *envp[],
-                 int *status)
+int run_command (const char *cmd, const char *argv[],
+                 /*@null@*/const char *envp[], /*@out@*/int *status)
 {
 	pid_t pid, wpid;
 

Modified: upstream/trunk/libmisc/cleanup.c
===================================================================
--- upstream/trunk/libmisc/cleanup.c	2011-10-18 20:16:00 UTC (rev 3519)
+++ upstream/trunk/libmisc/cleanup.c	2011-10-18 20:23:33 UTC (rev 3520)
@@ -38,8 +38,11 @@
  * The cleanup_functions stack.
  */
 #define CLEANUP_FUNCTIONS 10
+
+typedef /*@null@*/void * parg_t;
+
 static cleanup_function cleanup_functions[CLEANUP_FUNCTIONS];
-static void * cleanup_function_args[CLEANUP_FUNCTIONS];
+static parg_t cleanup_function_args[CLEANUP_FUNCTIONS];
 static pid_t cleanup_pid = 0;
 
 /*
@@ -83,7 +86,7 @@
 /*
  * add_cleanup - Add a cleanup_function to the cleanup_functions stack.
  */
-void add_cleanup (cleanup_function pcf, /*@null@*/void *arg)
+void add_cleanup (/*@notnull@*/cleanup_function pcf, /*@null@*/void *arg)
 {
 	unsigned int i;
 	assert (NULL != pcf);
@@ -103,7 +106,7 @@
 /*
  * del_cleanup - Remove a cleanup_function from the cleanup_functions stack.
  */
-void del_cleanup (cleanup_function pcf)
+void del_cleanup (/*@notnull@*/cleanup_function pcf)
 {
 	unsigned int i;
 	assert (NULL != pcf);

Modified: upstream/trunk/src/chage.c
===================================================================
--- upstream/trunk/src/chage.c	2011-10-18 20:16:00 UTC (rev 3519)
+++ upstream/trunk/src/chage.c	2011-10-18 20:23:33 UTC (rev 3520)
@@ -91,7 +91,7 @@
 static long expdate;
 
 /* local function prototypes */
-static void usage (int status);
+static /*@noreturn@*/void usage (int status);
 static void date_to_str (char *buf, size_t maxsize, time_t date);
 static int new_fields (void);
 static void print_date (time_t date);
@@ -101,12 +101,12 @@
 static void check_perms (void);
 static void open_files (bool readonly);
 static void close_files (void);
-static void fail_exit (int code);
+static /*@noreturn@*/void fail_exit (int code);
 
 /*
  * fail_exit - do some cleanup and exit with the given error code
  */
-static void fail_exit (int code)
+static /*@noreturn@*/void fail_exit (int code)
 {
 	if (spw_locked) {
 		if (spw_unlock () == 0) {
@@ -138,8 +138,9 @@
 /*
  * usage - print command line syntax and exit
  */
-static void usage (int status)
+static /*@noreturn@*/void usage (int status)
 {
+	(void)
 	fputs (_("Usage: chage [options] LOGIN\n"
 	         "\n"
 	         "Options:\n"
@@ -187,14 +188,14 @@
 	(void) puts (_("Enter the new value, or press ENTER for the default"));
 	(void) puts ("");
 
-	snprintf (buf, sizeof buf, "%ld", mindays);
+	(void) snprintf (buf, sizeof buf, "%ld", mindays);
 	change_field (buf, sizeof buf, _("Minimum Password Age"));
 	if (   (getlong (buf, &mindays) == 0)
 	    || (mindays < -1)) {
 		return 0;
 	}
 
-	snprintf (buf, sizeof buf, "%ld", maxdays);
+	(void) snprintf (buf, sizeof buf, "%ld", maxdays);
 	change_field (buf, sizeof buf, _("Maximum Password Age"));
 	if (   (getlong (buf, &maxdays) == 0)
 	    || (maxdays < -1)) {
@@ -218,14 +219,14 @@
 		}
 	}
 
-	snprintf (buf, sizeof buf, "%ld", warndays);
+	(void) snprintf (buf, sizeof buf, "%ld", warndays);
 	change_field (buf, sizeof buf, _("Password Expiration Warning"));
 	if (   (getlong (buf, &warndays) == 0)
 	    || (warndays < -1)) {
 		return 0;
 	}
 
-	snprintf (buf, sizeof buf, "%ld", inactdays);
+	(void) snprintf (buf, sizeof buf, "%ld", inactdays);
 	change_field (buf, sizeof buf, _("Password Inactive"));
 	if (   (getlong (buf, &inactdays) == 0)
 	    || (inactdays < -1)) {
@@ -261,7 +262,7 @@
 
 	tp = gmtime (&date);
 	if (NULL == tp) {
-		(void) printf ("time_t: %lu\n", date);
+		(void) printf ("time_t: %lu\n", (unsigned long)date);
 	} else {
 		(void) strftime (buf, sizeof buf, "%b %d, %Y", tp);
 		(void) puts (buf);
@@ -420,7 +421,7 @@
 			break;
 		case 'h':
 			usage (E_SUCCESS);
-			break;
+			/*@notreached@*/break;
 		case 'I':
 			Iflg = true;
 			if (   (getlong (optarg, &inactdays) == 0)
@@ -657,7 +658,8 @@
  *
  *	It will not return in case of error
  */
-static void update_age (const struct spwd *sp, const struct passwd *pw)
+static void update_age (/*@null@*/const struct spwd *sp,
+                        /*@notnull@*/const struct passwd *pw)
 {
 	struct spwd spwent;
 
@@ -709,7 +711,7 @@
 /*
  * get_defaults - get the value of the fields not set from the command line
  */
-static void get_defaults (const struct spwd *sp)
+static void get_defaults (/*@null@*/const struct spwd *sp)
 {
 	/*
 	 * Set the fields that aren't being set from the command line from




More information about the Pkg-shadow-commits mailing list