* 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:
nekral-guest 2011-07-14 13:29:05 +00:00
parent aec025dbf6
commit d51420bb01
2 changed files with 10 additions and 7 deletions

View File

@ -1,6 +1,9 @@
2011-07-14 Nicolas François <nicolas.francois@centraliens.net>
* 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>

View File

@ -1408,18 +1408,18 @@ static void move_home (void)
{
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
* should not use -m.
*/
if (access (user_newhome, F_OK) == 0) {
fprintf (stderr,
_("%s: directory %s exists\n"),
Prog, user_newhome);
fail_exit (E_HOMEDIR);
}
fprintf (stderr,
_("%s: directory %s exists\n"),
Prog, user_newhome);
fail_exit (E_HOMEDIR);
}
if (stat (user_home, &sb) == 0) {
/*
* Don't try to move it if it is not a directory
* (but /dev/null for example). --marekm