From e1cbd40ee41ef27e6f91a8b098cd2a0fd6e736f3 Mon Sep 17 00:00:00 2001 From: Sebastien Martini Date: Sat, 14 Apr 2012 18:12:16 +0200 Subject: Fixed runtime warnings in inotify ctypes' wrapper. Contributed by bdkearns https://github.com/bdkearns --- python2/pyinotify.py | 8 ++++++++ python3/pyinotify.py | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/python2/pyinotify.py b/python2/pyinotify.py index 204e381..cb562c5 100755 --- a/python2/pyinotify.py +++ b/python2/pyinotify.py @@ -220,6 +220,14 @@ class _CtypesLibcINotifyWrapper(INotifyWrapper): not hasattr(self._libc, 'inotify_add_watch') or not hasattr(self._libc, 'inotify_rm_watch')): return False + + self._libc.inotify_init.argtypes = [] + self._libc.inotify_init.restype = ctypes.c_int + self._libc.inotify_add_watch.argtypes = [ctypes.c_int, ctypes.c_char_p, + ctypes.c_uint32] + self._libc.inotify_add_watch.restype = ctypes.c_int + self._libc.inotify_rm_watch.argtypes = [ctypes.c_int, ctypes.c_int] + self._libc.inotify_rm_watch.restype = ctypes.c_int return True def _get_errno(self): diff --git a/python3/pyinotify.py b/python3/pyinotify.py index 531c9c9..8d27c1c 100755 --- a/python3/pyinotify.py +++ b/python3/pyinotify.py @@ -214,6 +214,14 @@ class _CtypesLibcINotifyWrapper(INotifyWrapper): not hasattr(self._libc, 'inotify_add_watch') or not hasattr(self._libc, 'inotify_rm_watch')): return False + + self._libc.inotify_init.argtypes = [] + self._libc.inotify_init.restype = ctypes.c_int + self._libc.inotify_add_watch.argtypes = [ctypes.c_int, ctypes.c_char_p, + ctypes.c_uint32] + self._libc.inotify_add_watch.restype = ctypes.c_int + self._libc.inotify_rm_watch.argtypes = [ctypes.c_int, ctypes.c_int] + self._libc.inotify_rm_watch.restype = ctypes.c_int return True def _get_errno(self): -- cgit v1.2.1