aboutsummaryrefslogtreecommitdiff
path: root/toys/posix/find.c
diff options
context:
space:
mode:
Diffstat (limited to 'toys/posix/find.c')
-rw-r--r--toys/posix/find.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/toys/posix/find.c b/toys/posix/find.c
index 65beeb54..a9c35f41 100644
--- a/toys/posix/find.c
+++ b/toys/posix/find.c
@@ -315,14 +315,13 @@ static int do_find(struct dirtree *new)
|| !strcmp(s, "path") || !strcmp(s, "ipath"))
{
int i = (*s == 'i');
- char *arg = ss[1], *path = 0, *name = new->name;
+ char *arg = ss[1], *path = 0, *name = new ? new->name : arg;
// Handle path expansion and case flattening
if (new && s[i] == 'p') name = path = dirtree_path(new, 0);
if (i) {
if (check || !new) {
- char *temp = new ? name : arg;
- name = temp ? strlower(temp) : 0;
+ if (name) name = strlower(name);
if (!new) {
dlist_add(&TT.argdata, name);
free(path);