summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
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);