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

View File

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