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,14 +132,15 @@ 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--;
}
}
free(path_dupe);
free(linkpath);
return dirfd;