[PATCH] tests/getdents: handle older getdents calls

Mike Frysinger vapier at gentoo.org
Sun Mar 1 08:11:35 UTC 2015


If the tools we use call older getdents syscalls where d_type isn't
passed back, or the arch is old (like Alpha) and can't pass back in
either version, make sure we don't fail.

* tests/getdents.awk (d_type_dir, d_type_reg): Accept DT_UNKNOWN.
---
 tests/getdents.awk | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tests/getdents.awk b/tests/getdents.awk
index f9dc64d..c230e26 100644
--- a/tests/getdents.awk
+++ b/tests/getdents.awk
@@ -11,8 +11,9 @@ BEGIN {
   d_name_1 = "d_name=\"\\.\""
   d_name_2 = "d_name=\"\\.\\.\""
   d_name_3 = "d_name=\"(A\\\\n){127}Z\""
-  d_type_dir = "d_type=DT_DIR"
-  d_type_reg = "d_type=DT_REG"
+  # Some older systems might not pass back d_type at all like Alpha.
+  d_type_dir = "d_type=DT_(DIR|UNKNOWN)"
+  d_type_reg = "d_type=DT_(REG|UNKNOWN)"
 
   dirent_1   = "\\{" d_ino ", " d_off ", " d_reclen ", " d_name_1 ", " d_type_dir "\\}"
   dirent_2   = "\\{" d_ino ", " d_off ", " d_reclen ", " d_name_2 ", " d_type_dir "\\}"
-- 
2.3.1





More information about the Strace-devel mailing list