pw: Fix a resource leak.

Reported by:	Coverity
MFC after:	1 week
Sponsored by:	NetApp, Inc.
Sponsored by:	Klara, Inc.
This commit is contained in:
Mark Johnston 2020-09-01 15:14:51 +00:00
parent 45bfd3158c
commit 7a82cf511d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=365045

View File

@ -57,6 +57,10 @@ rm_r(int rootfd, const char *path, uid_t uid)
}
d = fdopendir(dirfd);
if (d == NULL) {
(void)close(dirfd);
return;
}
while ((e = readdir(d)) != NULL) {
if (strcmp(e->d_name, ".") == 0 || strcmp(e->d_name, "..") == 0)
continue;