summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastien Martini <seb@dbzteam.org>2008-12-17 03:00:50 +0100
committerSebastien Martini <seb@dbzteam.org>2008-12-17 03:00:50 +0100
commit0c76263e0c9fd8dce89e769c0b138bc71f78cecc (patch)
tree267a09412126fae4590530df530a181b5f68dd2f
parent46a7343c64fa1614dcef1e5044cd6c5caea4599e (diff)
downloadpyinotify-0c76263e0c9fd8dce89e769c0b138bc71f78cecc.tar.gz
Check libc version (contributed by Robin Wittler <robin.wittler@credativ.de>).
-rwxr-xr-xpyinotify.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/pyinotify.py b/pyinotify.py
index 8e597da..50d0776 100755
--- a/pyinotify.py
+++ b/pyinotify.py
@@ -61,8 +61,15 @@ __metaclass__ = type # Use new-style classes by default
# load libc
-# ctypes.CDLL("libc.so.6")
-LIBC = ctypes.cdll.LoadLibrary(ctypes.util.find_library('libc'))
+LIBC = ctypes.cdll.LoadLibrary(ctypes.util.find_library('c'))
+
+# the libc version check.
+# XXX: Maybe it is better to check if the libc has the needed functions inside?
+# Because there are inotify patches for libc 2.3.6.
+if not ctypes.cast(LIBC.gnu_get_libc_version(),
+ ctypes.c_char_p).value >= '2.4':
+ sys.stderr.write('pyinotify needs libc6 version 2.4 or higher')
+ sys.exit(1)
# logging