find -size implies -type f.
diff --git a/tests/find.test b/tests/find.test
index d57d191..862edc9 100755
--- a/tests/find.test
+++ b/tests/find.test
@@ -156,4 +156,7 @@
touch -d @12346 dir/two
testing 'newerat' 'find dir -type f -newerat @12345' 'dir/two\n' '' ''
testing 'newer nano' 'find dir -type f -newerat @12345.67890' 'dir/two\n' '' ''
+ln -s one dir/three
+testing '-size implies -type f' 'find dir -size -1M | sort' \
+ 'dir/one\ndir/two\n' '' ''
rm -rf dir
diff --git a/toys/posix/find.c b/toys/posix/find.c
index 0fde9c9..c8e6868 100644
--- a/toys/posix/find.c
+++ b/toys/posix/find.c
@@ -438,7 +438,8 @@
if (*ss != arg) free(arg);
}
} else if (!strcmp(s, "size")) {
- if (check) test = compare_numsign(new->st.st_size, 512, arg);
+ if (check) test = compare_numsign(new->st.st_size, -512, arg) &&
+ ((new->st.st_mode & S_IFMT) == S_IFREG);
} else if (!strcmp(s, "links")) {
if (check) test = compare_numsign(new->st.st_nlink, 0, arg);
} else if (!strcmp(s, "inum")) {