]> git.cameronkatri.com Git - pw-darwin.git/commitdiff
Do not try to delete the home of the user if is is not a directory for example
authorBaptiste Daroussin <bapt@FreeBSD.org>
Sat, 23 Jul 2016 10:19:10 +0000 (10:19 +0000)
committerBaptiste Daroussin <bapt@FreeBSD.org>
Sat, 23 Jul 2016 10:19:10 +0000 (10:19 +0000)
"/dev/null"

PR: 211195
Submitted by: rday <ryan@ryanday.net>
Reported by: eniorm <eniorm@gmail.com>
MFC after: 1 day

pw/rm_r.c

index 172c7b02e1db0d2bd1477ca33c1bc6d1b338d95b..45fc5d14663aff9c70e4e5f0e8c15c8993c65b99 100644 (file)
--- 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) {