On 26/06/16 21:48, Pádraig Brady wrote:
> On 26/06/16 21:26, Pádraig Brady wrote:
>> On 22/06/16 15:54, Pádraig Brady wrote:
>>> Cool, I'll add that test in your name to coreutils.
>>
>> Attached.
> 
> Small adjustment attached.

Bernhard Voelker noticed a problem with that on 32 bit,
which the attached should fix.

thanks,
Pádraig

>From 54c1397510cb08433680b5b7da46a8201770e9ee Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <[email protected]>
Date: Wed, 6 Jul 2016 18:08:32 +0100
Subject: [PATCH] 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.
---
 tests/rm/rm-readdir-fail.sh | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/tests/rm/rm-readdir-fail.sh b/tests/rm/rm-readdir-fail.sh
index 15ef1d6..d9d8efd 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:
-- 
2.5.5

Reply via email to