* src/useradd.c: Keep the default file as much as possible to
avoid issue in case of crash. Use link instead of rename.
This commit is contained in:
parent
56845ad1c1
commit
1a7960421e
@ -1,3 +1,8 @@
|
|||||||
|
2012-05-18 Nicolas François <nicolas.francois@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@redhat.com>
|
2012-05-18 Peter Vrabec <pvrabec@redhat.com>
|
||||||
|
|
||||||
* lib/commonio.c: Fix labeling of /etc/{passwd,shadow,group,gshadow}.
|
* lib/commonio.c: Fix labeling of /etc/{passwd,shadow,group,gshadow}.
|
||||||
|
@ -557,11 +557,12 @@ static int set_defaults (void)
|
|||||||
*/
|
*/
|
||||||
wlen = snprintf (buf, sizeof buf, "%s-", USER_DEFAULTS_FILE);
|
wlen = snprintf (buf, sizeof buf, "%s-", USER_DEFAULTS_FILE);
|
||||||
assert (wlen < (int) sizeof buf);
|
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;
|
int err = errno;
|
||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
_("%s: rename: %s: %s\n"),
|
_("%s: Cannot create backup file (%s): %s\n"),
|
||||||
Prog, USER_DEFAULTS_FILE, strerror (err));
|
Prog, buf, strerror (err));
|
||||||
unlink (new_file);
|
unlink (new_file);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user