From 58737c7791b44d9d7cd011d3385bf66ea24d9830 Mon Sep 17 00:00:00 2001 From: Martin Basti Date: Wed, 29 Oct 2014 14:45:45 +0100 Subject: [PATCH] Fix pk11helper module compiler warnings Ticket: https://fedorahosted.org/freeipa/ticket/4657 Reviewed-By: David Kupka --- ipapython/ipap11helper/library.c | 10 +++------- ipapython/ipap11helper/library.h | 2 +- ipapython/ipap11helper/p11helper.c | 3 ++- ipapython/ipap11helper/setup.py | 1 - 4 files changed, 6 insertions(+), 10 deletions(-) diff --git a/ipapython/ipap11helper/library.c b/ipapython/ipap11helper/library.c index 51e24ebc2..fc4c1e41c 100644 --- a/ipapython/ipap11helper/library.c +++ b/ipapython/ipap11helper/library.c @@ -44,7 +44,7 @@ #include // Load the PKCS#11 library -CK_C_GetFunctionList loadLibrary(char* module, void** moduleHandle) +CK_C_GetFunctionList loadLibrary(const char* module, void** moduleHandle) { CK_C_GetFunctionList pGetFunctionList = NULL; @@ -54,13 +54,9 @@ CK_C_GetFunctionList loadLibrary(char* module, void** moduleHandle) if (module) { pDynLib = dlopen(module, RTLD_NOW | RTLD_LOCAL); + } else { + return NULL; } - /* - else - { - pDynLib = dlopen(DEFAULT_PKCS11_LIB, RTLD_NOW | RTLD_LOCAL); - } - */ if (pDynLib == NULL) { diff --git a/ipapython/ipap11helper/library.h b/ipapython/ipap11helper/library.h index 2ceb9e375..afcbd9fd2 100644 --- a/ipapython/ipap11helper/library.h +++ b/ipapython/ipap11helper/library.h @@ -42,7 +42,7 @@ #include -CK_C_GetFunctionList loadLibrary(char* module, void** moduleHandle); +CK_C_GetFunctionList loadLibrary(const char* module, void** moduleHandle); void unloadLibrary(void* moduleHandle); #endif // !_SOFTHSM_V2_BIN_LIBRARY_H diff --git a/ipapython/ipap11helper/p11helper.c b/ipapython/ipap11helper/p11helper.c index 038c26c45..c1d100772 100644 --- a/ipapython/ipap11helper/p11helper.c +++ b/ipapython/ipap11helper/p11helper.c @@ -1659,10 +1659,11 @@ P11_Helper_set_attribute(P11_Helper* self, PyObject *args, PyObject *kwds) { goto final; } if (PyString_AsStringAndSize(value, (char **) &attribute.pValue, - &attribute.ulValueLen) == -1) { + &len) == -1) { ret = NULL; goto final; } + attribute.ulValueLen = len; break; case CKA_LABEL: if (!PyUnicode_Check(value)) { diff --git a/ipapython/ipap11helper/setup.py b/ipapython/ipap11helper/setup.py index 338cdcb2e..e8e824a33 100644 --- a/ipapython/ipap11helper/setup.py +++ b/ipapython/ipap11helper/setup.py @@ -23,7 +23,6 @@ module = Extension('_ipap11helper', '-ggdb3', '-O2', '-W', - '-pedantic', '-Wall', '-Wno-unused-parameter', '-Wbad-function-cast',