aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2019-06-19 16:45:10 -0700
committerBruce Hill <bruce@bruce-hill.com>2019-06-19 16:45:10 -0700
commit61cf1bf90c94fd19701c644603a39ff98c86a0ea (patch)
tree5c529440c5c3ec4a3d005b4f1d0cbba8dac485a0
parent6f660ac2369ba7ba849af168c1a674daad18d8dc (diff)
Fixed issue with extra '/' appearing in link paths
-rw-r--r--bb.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/bb.c b/bb.c
index ec74496..5d6f3cd 100644
--- a/bb.c
+++ b/bb.c
@@ -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);