summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2023-07-13 16:00:02 -0400
committerTavian Barnes <tavianator@tavianator.com>2023-07-13 16:04:18 -0400
commitb4c3201ccceb9c73dd7751d7f9937b4afe78966f (patch)
tree149930ae81ac27d899316165333de4f1aeb50410 /src
parent0e4dffeb46f3d8bfe30d60a0cfe1e1fa5a082b13 (diff)
downloadbfs-b4c3201ccceb9c73dd7751d7f9937b4afe78966f.tar.xz
color: Only highlight the trailing slash on ENOTDIR
Diffstat (limited to 'src')
-rw-r--r--src/color.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/color.c b/src/color.c
index 7d98978..f7a5d86 100644
--- a/src/color.c
+++ b/src/color.c
@@ -982,8 +982,10 @@ static ssize_t first_broken_offset(const char *path, const struct BFTW *ftwbuf,
while (ret && at_path[len - 1] == '/') {
--len, --ret;
}
- while (ret && at_path[len - 1] != '/') {
- --len, --ret;
+ if (errno != ENOTDIR) {
+ while (ret && at_path[len - 1] != '/') {
+ --len, --ret;
+ }
}
dstresize(&at_path, len);