summaryrefslogtreecommitdiffstats
path: root/eval.c
diff options
context:
space:
mode:
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c13
1 files changed, 1 insertions, 12 deletions
diff --git a/eval.c b/eval.c
index 6a3da7a..4494cff 100644
--- a/eval.c
+++ b/eval.c
@@ -599,23 +599,12 @@ bool eval_lname(const struct expr *expr, struct eval_state *state) {
goto done;
}
- size_t size = statbuf->st_size + 1;
- name = malloc(size);
+ name = xreadlinkat(ftwbuf->at_fd, ftwbuf->at_path, statbuf->st_size);
if (!name) {
eval_error(state);
goto done;
}
- ssize_t len = readlinkat(ftwbuf->at_fd, ftwbuf->at_path, name, size);
- if (len < 0) {
- eval_error(state);
- goto done;
- } else if (len >= size) {
- goto done;
- }
-
- name[len] = '\0';
-
ret = fnmatch(expr->sdata, name, expr->idata) == 0;
done: