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

nekral-guest at alioth.debian.org nekral-guest at alioth.debian.org
Sat Aug 9 23:31:37 UTC 2008


Author: nekral-guest
Date: 2008-08-09 23:31:36 +0000 (Sat, 09 Aug 2008)
New Revision: 2261

Modified:
   upstream/trunk/ChangeLog
   upstream/trunk/src/vipw.c
Log:
	* src/vipw.c: Report failures to remove files to stderr.
	* src/vipw.c: Report failures to unlock files to stderr.

Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog	2008-08-09 23:28:30 UTC (rev 2260)
+++ upstream/trunk/ChangeLog	2008-08-09 23:31:36 UTC (rev 2261)
@@ -1,5 +1,10 @@
 2008-08-07  Nicolas François  <nicolas.francois at centraliens.net>
 
+	* src/vipw.c: Report failures to remove files to stderr.
+	* src/vipw.c: Report failures to unlock files to stderr.
+
+2008-08-07  Nicolas François  <nicolas.francois at centraliens.net>
+
 	* NEWS, src/groupmems.c: Added syslog support.
 	* src/groupmems.c: members() renamed display_members() to
 	avoid name clash with its members argument.

Modified: upstream/trunk/src/vipw.c
===================================================================
--- upstream/trunk/src/vipw.c	2008-08-09 23:28:30 UTC (rev 2260)
+++ upstream/trunk/src/vipw.c	2008-08-09 23:31:36 UTC (rev 2261)
@@ -62,7 +62,7 @@
 /* local function prototypes */
 static void usage (void);
 static int create_backup_file (FILE *, const char *, struct stat *);
-static void vipwexit (const char *, int, int);
+static void vipwexit (const char *msg, int syserr, int ret);
 static void vipwedit (const char *, int (*)(void), int (*)(void));
 
 /*
@@ -136,10 +136,16 @@
 	int err = errno;
 
 	if (createedit) {
-		unlink (fileeditname);
+		if (unlink (fileeditname) != 0) {
+			fprintf (stderr, _("%s: failed to remove %s\n"), progname, fileeditname);
+			/* continue */
+		}
 	}
 	if (filelocked) {
-		(*unlock) ();
+		if ((*unlock) () == 0) {
+			fprintf (stderr, _("%s: failed to unlock %s\n"), progname, fileeditname);
+			/* continue */
+		}
 	}
 	if (NULL != msg) {
 		fprintf (stderr, "%s: %s", progname, msg);
@@ -147,8 +153,9 @@
 	if (0 != syserr) {
 		fprintf (stderr, ": %s", strerror (err));
 	}
+	(void) fputs ("\n", stderr);
 	if (!quiet) {
-		fprintf (stdout, _("\n%s: %s is unchanged\n"), progname,
+		fprintf (stdout, _("%s: %s is unchanged\n"), progname,
 			 filename);
 	}
 	exit (ret);
@@ -262,13 +269,15 @@
 	link (file, filebackup);
 	if (rename (fileedit, file) == -1) {
 		fprintf (stderr,
-			 _
-			 ("%s: can't restore %s: %s (your changes are in %s)\n"),
-			 progname, file, strerror (errno), fileedit);
+		         _("%s: can't restore %s: %s (your changes are in %s)\n"),
+		         progname, file, strerror (errno), fileedit);
 		vipwexit (0, 0, 1);
 	}
 
-	(*file_unlock) ();
+	if ((*file_unlock) () == 0) {
+		fprintf (stderr, _("%s: failed to unlock %s\n"), progname, fileeditname);
+		/* continue */
+	}
 }
 
 int main (int argc, char **argv)




More information about the Pkg-shadow-commits mailing list