summaryrefslogtreecommitdiffstats
path: root/color.c
diff options
context:
space:
mode:
Diffstat (limited to 'color.c')
-rw-r--r--color.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/color.c b/color.c
index b003cff..f04bdf5 100644
--- a/color.c
+++ b/color.c
@@ -850,24 +850,21 @@ static int print_path(CFILE *cfile, const struct BFTW *ftwbuf) {
/** Print a link target with the appropriate colors. */
static int print_link_target(CFILE *cfile, const struct BFTW *ftwbuf) {
- int ret = -1;
-
const struct bfs_stat *statbuf = bftw_cached_stat(ftwbuf, BFS_STAT_NOFOLLOW);
size_t len = statbuf ? statbuf->size : 0;
char *target = xreadlinkat(ftwbuf->at_fd, ftwbuf->at_path, len);
if (!target) {
- goto done;
+ return -1;
}
- if (!cfile->colors) {
+ int ret;
+ if (cfile->colors) {
+ ret = print_path_colored(cfile, target, ftwbuf, BFS_STAT_FOLLOW);
+ } else {
ret = dstrcat(&cfile->buffer, target);
- goto done;
}
- ret = print_path_colored(cfile, target, ftwbuf, BFS_STAT_FOLLOW);
-
-done:
free(target);
return ret;
}