From 3ee82e344cfdc0dc357bd69f319305d9b1253437 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Wed, 17 Sep 2014 21:05:21 +0200 Subject: fix TLS error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- DEPENDENCIES | 4 ++-- src/libgamma_native_error.pyx | 24 ++++++++++++++---------- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/DEPENDENCIES b/DEPENDENCIES index 7d3cf9f..217abad 100644 --- a/DEPENDENCIES +++ b/DEPENDENCIES @@ -1,14 +1,14 @@ RUNTIME DEPENDENCIES: python3 - libgamma>=0.3 + libgamma>=0.6 libc BUILD DEPENDENCIES: python3 - libgamma>=0.3 + libgamma>=0.6 libc make c99 diff --git a/src/libgamma_native_error.pyx b/src/libgamma_native_error.pyx index 5c419cc..fb2d8d2 100644 --- a/src/libgamma_native_error.pyx +++ b/src/libgamma_native_error.pyx @@ -23,13 +23,15 @@ from posix.unistd cimport gid_t from libc.string cimport strerror as c_strerror -cdef extern gid_t libgamma_group_gid +cdef extern gid_t libgamma_group_gid_get() +cdef extern void libgamma_group_gid_set(gid_t) ''' Group that the user needs to be a member of if `LIBGAMMA_DEVICE_REQUIRE_GROUP` is returned. ''' -cdef extern const char* libgamma_group_name +cdef extern const char* libgamma_group_name_get() +cdef extern void libgamma_group_name_set(const char*) ''' Group that the user needs to be a member of if `LIBGAMMA_DEVICE_REQUIRE_GROUP` is returned, @@ -85,7 +87,7 @@ def libgamma_native_get_group_gid() -> int: Group that the user needs to be a member of if `LIBGAMMA_DEVICE_REQUIRE_GROUP` is returned. ''' - return int(libgamma_group_gid) + return int(libgamma_group_gid_get()) def libgamma_native_set_group_gid(gid : int): ''' @@ -94,8 +96,7 @@ def libgamma_native_set_group_gid(gid : int): Group that the user needs to be a member of if `LIBGAMMA_DEVICE_REQUIRE_GROUP` is returned. ''' - global libgamma_group_gid - libgamma_group_gid = gid + libgamma_group_gid_set(gid) def libgamma_native_get_group_name() -> str: @@ -107,10 +108,12 @@ def libgamma_native_get_group_name() -> str: `None` if the name of the group `libgamma_group_gid` cannot be determined. ''' + cdef const char* group_name cdef bytes bs - if libgamma_group_name is NULL: + group_name = libgamma_group_name_get() + if group_name is NULL: return None - bs = libgamma_group_name + bs = group_name return bs.decode('utf-8', 'strict') def libgamma_native_set_group_name(name : str): @@ -122,13 +125,14 @@ def libgamma_native_set_group_name(name : str): `None` if the name of the group `libgamma_group_gid` cannot be determined. ''' - global libgamma_group_name + cdef const char* group_name cdef bytes bs if name is None: - libgamma_group_name = NULL + libgamma_group_name_set(NULL) return bs = name.encode('utf-8') + bytes([0]) - libgamma_group_name = bs + group_name = bs + libgamma_group_name_set(group_name) def libgamma_native_perror(name : str, error_code : int): -- cgit v1.2.3-70-g09d2