summaryrefslogtreecommitdiffstats
path: root/bfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'bfs.c')
-rw-r--r--bfs.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/bfs.c b/bfs.c
index 7669e6d..a203468 100644
--- a/bfs.c
+++ b/bfs.c
@@ -52,6 +52,9 @@ typedef struct {
*/
static void fill_statbuf(eval_state *state) {
struct BFTW *ftwbuf = state->ftwbuf;
+ if (ftwbuf->statbuf) {
+ return;
+ }
if (fstatat(ftwbuf->at_fd, ftwbuf->at_path, &state->statbuf, AT_SYMLINK_NOFOLLOW) == 0) {
ftwbuf->statbuf = &state->statbuf;
@@ -357,10 +360,11 @@ static bool eval_name(const expression *expr, eval_state *state) {
* -print action.
*/
static bool eval_print(const expression *expr, eval_state *state) {
- if (state->cl->colors) {
+ color_table *colors = state->cl->colors;
+ if (colors) {
fill_statbuf(state);
}
- pretty_print(state->cl->colors, state->ftwbuf);
+ pretty_print(colors, state->ftwbuf);
return true;
}