checkpath: fix code to walk the directory path

X-Gentoo-Bug: 782808
X-Gentoo-Bug-URL: https://bugs.gentoo.org/782808
This commit is contained in:
William Hubbs 2021-04-15 17:39:51 -05:00
parent 63db2d99e7
commit 791322d7fa
1 changed files with 3 additions and 2 deletions

View File

@ -132,13 +132,14 @@ static int get_dirfd(char *path, bool symlinks)
*/
close(new_dirfd);
} else {
/* now walk down the directory path */
close(dirfd);
dirfd = new_dirfd;
free(linkpath);
linkpath = NULL;
item = strtok(NULL, "/");
components--;
}
item = strtok(NULL, "/");
components--;
}
free(path_dupe);
free(linkpath);