]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tests: d_type-check: don't hardcode the C library name
authorMike Frysinger <vapier@gentoo.org>
Thu, 23 Oct 2014 02:30:23 +0000 (03:30 +0100)
committerPádraig Brady <P@draigBrady.com>
Thu, 23 Oct 2014 02:30:23 +0000 (03:30 +0100)
* tests/d_type-check: The hardcoded name doesn't hold true for all
Linux/glibc platforms, let alone Linux/non-glibc.
Use ctypes.util.find_library() instead to search for the library.

tests/d_type-check

index 33c1fd6d0b8cee979a08db9076da31691ca46024..ff1eb60b919a8f624cfcb76d8e225af7b6a3dbe5 100644 (file)
@@ -5,7 +5,7 @@ import sys
 
 fail = 1
 try:
-  import ctypes
+  import ctypes.util
 
   (DT_UNKNOWN, DT_DIR,) = (0, 4,)
 
@@ -19,8 +19,7 @@ try:
 
   direntp = ctypes.POINTER(dirent)
 
-  # FIXME: find a way to avoid hard-coding libc's so-name.
-  libc = ctypes.cdll.LoadLibrary("libc.so.6")
+  libc = ctypes.CDLL(ctypes.util.find_library('c'), use_errno=True)
   libc.readdir.restype = direntp
 
   dirp = libc.opendir(".")