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>
{
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