diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2019-06-19 16:45:10 -0700 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2019-06-19 16:45:10 -0700 |
| commit | 61cf1bf90c94fd19701c644603a39ff98c86a0ea (patch) | |
| tree | 5c529440c5c3ec4a3d005b4f1d0cbba8dac485a0 | |
| parent | 6f660ac2369ba7ba849af168c1a674daad18d8dc (diff) | |
Fixed issue with extra '/' appearing in link paths
| -rw-r--r-- | bb.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -733,7 +733,8 @@ entry_t* load_entry(bb_t *bb, const char *path, int clear_dots) if (S_ISLNK(filestat.st_mode)) { linkpathlen = readlink(pbuf, linkbuf, sizeof(linkbuf)); if (linkpathlen < 0) err("Couldn't read link: '%s'", pbuf); - linkbuf[linkpathlen] = 0; + linkbuf[linkpathlen] = '\0'; + while (linkpathlen > 0 && linkbuf[linkpathlen-1] == '/') linkbuf[--linkpathlen] = '\0'; if (stat(pbuf, &linkedstat) == -1) memset(&linkedstat, 0, sizeof(linkedstat)); } size_t pathlen = strlen(pbuf); |
