useradd treats /nonexistent specially whene creating the home dir.
Should userdel also treat /nonexistent specially when deleting it?
In particular, should nonexisting /nonexistent be an error?

        Jan


Index: user.c
===================================================================
RCS file: /cvs/src/usr.sbin/user/user.c,v
retrieving revision 1.92
diff -u -p -r1.92 user.c
--- user.c      20 Sep 2012 11:32:06 -0000      1.92
+++ user.c      7 Jan 2013 20:37:49 -0000
@@ -231,6 +231,10 @@ removehomedir(const char *user, uid_t ui
        }
 
        /* directory exists (and is a directory!) */
+       if (strcmp(dir, _PATH_NONEXISTENT) == 0) {
+               warnx("Not trying to delete `%s'", dir);
+               return 1;
+       }
        if (stat(dir, &st) < 0) {
                warnx("Home directory `%s' doesn't exist", dir);
                return 0;

Reply via email to