From 8e2010a26c5675a76ccb89d3be2f922f2a825de3 Mon Sep 17 00:00:00 2001 From: nekral-guest Date: Thu, 18 Mar 2010 18:57:03 +0000 Subject: [PATCH] * src/useradd.c: When exiting because of a failure, warn if an home directory created, but cannot be removed. --- ChangeLog | 5 +++++ src/useradd.c | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index e20922cd..af852475 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2010-03-18 Nicolas François + + * src/useradd.c: When exiting because of a failure, warn if an + home directory created, but cannot be removed. + 2010-03-18 Nicolas François * libmisc/chowndir.c: Re-indent. diff --git a/src/useradd.c b/src/useradd.c index ee656f7c..31377c5c 100644 --- a/src/useradd.c +++ b/src/useradd.c @@ -208,7 +208,12 @@ static void create_mail (void); static void fail_exit (int code) { if (home_added) { - rmdir (user_home); + if (rmdir (user_home) != 0) { + frpintf (stderr, + _("%s: %s was created, but could not be removed\n"), + Prog, user_home); + SYSLOG ((LOG_ERR, "failed to remove %s", user_home)); + } } if (spw_locked) {