From ae4f3b0a81875867702cade7ba2f5920d92ee481 Mon Sep 17 00:00:00 2001 From: Baptiste Daroussin Date: Sat, 23 Jul 2016 10:19:10 +0000 Subject: 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 Reported by: eniorm MFC after: 1 day --- pw/rm_r.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'pw') 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) { -- cgit v1.2.3-56-ge451