--- shadow-4.0.13/src/useradd.c.orig 2008-02-01 13:23:21.000000000 -0800 +++ shadow-4.0.13/src/useradd.c 2008-02-01 13:25:05.000000000 -0800 @@ -844,9 +844,12 @@ static void find_new_uid (void) * Start with some UID value if the user didn't provide us with * one already. */ - if (!uflg) + if (!uflg) { user_id = uid_min; - + } else { + if (!getpwuid(user_id) && !getpwnam(user_name)) + return; + } /* * Search the entire password file, either looking for this * UID (if the user specified one with -u) or looking for the