summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2016-07-06 18:08:32 +0100
committerPádraig Brady <P@draigBrady.com>2016-07-06 18:13:08 +0100
commit54c1397510cb08433680b5b7da46a8201770e9ee (patch)
tree3dc152c8a6949e363a162e89a4f7ab08ca2ce1f3
parent383e4b2ce589f6ecf0a375e94ab56fab6eff88f1 (diff)
downloadcoreutils-54c1397510cb08433680b5b7da46a8201770e9ee.tar.xz
tests: avoid false failure on 32 bit in readdir() test
* tests/rm/rm-readdir-fail.sh: Since we use the returned dirent from the readdir wrapper it must be the correct type and not just cast. Therefore setup so that we only have to define a wrapper for readdir(), which works appropriately on 32 and 64 bit. Issue reported by Bernhard Voelker, where rm was seen to invoke rmdir() on invalid file names.
-rwxr-xr-xtests/rm/rm-readdir-fail.sh11
1 files changed, 6 insertions, 5 deletions
diff --git a/tests/rm/rm-readdir-fail.sh b/tests/rm/rm-readdir-fail.sh
index 15ef1d6c4..d9d8efdb4 100755
--- a/tests/rm/rm-readdir-fail.sh
+++ b/tests/rm/rm-readdir-fail.sh
@@ -26,6 +26,12 @@ mkdir -p dir/notempty || framework_failure_
# Simulate "readdir" failure.
cat > k.c <<\EOF || framework_failure_
#define _GNU_SOURCE
+
+/* Setup so we don't have to worry about readdir64. */
+#ifndef __LP64__
+# define _FILE_OFFSET_BITS 64
+#endif
+
#include <dlfcn.h>
#include <dirent.h>
#include <errno.h>
@@ -72,11 +78,6 @@ struct dirent *readdir (DIR *dirp)
errno = ENOENT;
return NULL;
}
-
-struct dirent64 *readdir64 (DIR *dirp)
-{
- return (struct dirent64 *) readdir (dirp);
-}
EOF
# Then compile/link it: