* src/usermod.c (move_home): It is always an error to use -m if
the new home directory already exist (independently from the existence of the old home directory did not exist)
This commit is contained in:
parent
aec025dbf6
commit
d51420bb01
@ -1,6 +1,9 @@
|
|||||||
2011-07-14 Nicolas François <nicolas.francois@centraliens.net>
|
2011-07-14 Nicolas François <nicolas.francois@centraliens.net>
|
||||||
|
|
||||||
* src/usermod.c: Fix typo in comment.
|
* src/usermod.c: Fix typo in comment.
|
||||||
|
* src/usermod.c (move_home): It is always an error to use -m if
|
||||||
|
the new home directory already exist (independently from the
|
||||||
|
existence of the old home directory did not exist)
|
||||||
|
|
||||||
2011-07-08 Nicolas François <nicolas.francois@centraliens.net>
|
2011-07-08 Nicolas François <nicolas.francois@centraliens.net>
|
||||||
|
|
||||||
|
@ -1408,18 +1408,18 @@ static void move_home (void)
|
|||||||
{
|
{
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
|
|
||||||
if (stat (user_home, &sb) == 0) {
|
if (access (user_newhome, F_OK) == 0) {
|
||||||
/*
|
/*
|
||||||
* If the new home directory already exist, the user
|
* If the new home directory already exist, the user
|
||||||
* should not use -m.
|
* should not use -m.
|
||||||
*/
|
*/
|
||||||
if (access (user_newhome, F_OK) == 0) {
|
|
||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
_("%s: directory %s exists\n"),
|
_("%s: directory %s exists\n"),
|
||||||
Prog, user_newhome);
|
Prog, user_newhome);
|
||||||
fail_exit (E_HOMEDIR);
|
fail_exit (E_HOMEDIR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (stat (user_home, &sb) == 0) {
|
||||||
/*
|
/*
|
||||||
* Don't try to move it if it is not a directory
|
* Don't try to move it if it is not a directory
|
||||||
* (but /dev/null for example). --marekm
|
* (but /dev/null for example). --marekm
|
||||||
|
Loading…
Reference in New Issue
Block a user