[Pkg-shadow-commits] r3728 - in upstream/trunk: . src
Nicolas FRANÇOIS
nekral-guest at alioth.debian.org
Fri May 18 20:28:16 UTC 2012
Author: nekral-guest
Date: 2012-05-18 20:28:16 +0000 (Fri, 18 May 2012)
New Revision: 3728
Modified:
upstream/trunk/ChangeLog
upstream/trunk/src/useradd.c
Log:
* src/useradd.c: Keep the default file as much as possible to
avoid issue in case of crash. Use link instead of rename.
Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog 2012-05-18 19:44:53 UTC (rev 3727)
+++ upstream/trunk/ChangeLog 2012-05-18 20:28:16 UTC (rev 3728)
@@ -1,3 +1,8 @@
+2012-05-18 Nicolas François <nicolas.francois at centraliens.net>
+
+ * src/useradd.c: Keep the default file as much as possible to
+ avoid issue in case of crash. Use link instead of rename.
+
2012-05-18 Peter Vrabec <pvrabec at redhat.com>
* lib/commonio.c: Fix labeling of /etc/{passwd,shadow,group,gshadow}.
Modified: upstream/trunk/src/useradd.c
===================================================================
--- upstream/trunk/src/useradd.c 2012-05-18 19:44:53 UTC (rev 3727)
+++ upstream/trunk/src/useradd.c 2012-05-18 20:28:16 UTC (rev 3728)
@@ -557,11 +557,12 @@
*/
wlen = snprintf (buf, sizeof buf, "%s-", USER_DEFAULTS_FILE);
assert (wlen < (int) sizeof buf);
- if ((rename (USER_DEFAULTS_FILE, buf) != 0) && (ENOENT != errno)) {
+ unlink (buf);
+ if ((link (USER_DEFAULTS_FILE, buf) != 0) && (ENOENT != errno)) {
int err = errno;
fprintf (stderr,
- _("%s: rename: %s: %s\n"),
- Prog, USER_DEFAULTS_FILE, strerror (err));
+ _("%s: Cannot create backup file (%s): %s\n"),
+ Prog, buf, strerror (err));
unlink (new_file);
return -1;
}
More information about the Pkg-shadow-commits
mailing list