aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--loginutils/deluser.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/loginutils/deluser.c b/loginutils/deluser.c
index 56bc7eaa6..8e7df737c 100644
--- a/loginutils/deluser.c
+++ b/loginutils/deluser.c
@@ -99,8 +99,14 @@ int deluser_main(int argc, char **argv)
99 pfile = bb_path_passwd_file; 99 pfile = bb_path_passwd_file;
100 if (ENABLE_FEATURE_SHADOWPASSWDS) 100 if (ENABLE_FEATURE_SHADOWPASSWDS)
101 sfile = bb_path_shadow_file; 101 sfile = bb_path_shadow_file;
102 if (opt_delhome) 102 if (opt_delhome) {
103 remove_file(pw->pw_dir, FILEUTILS_RECUR); 103 struct stat st;
104
105 /* Make sure home is an actual directory before
106 * removing it (e.g. users with /dev/null as home) */
107 if (stat(pw->pw_dir, &st) == 0 && S_ISDIR(st.st_mode))
108 remove_file(pw->pw_dir, FILEUTILS_RECUR);
109 }
104 } else { 110 } else {
105 struct group *gr; 111 struct group *gr;
106 do_delgroup: 112 do_delgroup: