summaryrefslogtreecommitdiffstats
path: root/pw
diff options
context:
space:
mode:
authorBaptiste Daroussin <bapt@FreeBSD.org>2016-07-23 10:19:10 +0000
committerBaptiste Daroussin <bapt@FreeBSD.org>2016-07-23 10:19:10 +0000
commitae4f3b0a81875867702cade7ba2f5920d92ee481 (patch)
tree996c107ff7eb254ada4e7753fafb8043b464d2c2 /pw
parente9e9b3528bf75d192d0a273a1d3f7e11a83103f7 (diff)
downloadpw-darwin-ae4f3b0a81875867702cade7ba2f5920d92ee481.tar.gz
pw-darwin-ae4f3b0a81875867702cade7ba2f5920d92ee481.tar.zst
pw-darwin-ae4f3b0a81875867702cade7ba2f5920d92ee481.zip
Do not try to delete the home of the user if is is not a directory for example
"/dev/null" PR: 211195 Submitted by: rday <ryan@ryanday.net> Reported by: eniorm <eniorm@gmail.com> MFC after: 1 day
Diffstat (limited to 'pw')
-rw-r--r--pw/rm_r.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/pw/rm_r.c b/pw/rm_r.c
index 172c7b0..45fc5d1 100644
--- a/pw/rm_r.c
+++ b/pw/rm_r.c
@@ -50,6 +50,9 @@ rm_r(int rootfd, const char *path, uid_t uid)
path++;
dirfd = openat(rootfd, path, O_DIRECTORY);
+ if (dirfd == -1) {
+ return;
+ }
d = fdopendir(dirfd);
while ((e = readdir(d)) != NULL) {