summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoman Bogorodskiy <bogorodskiy@gmail.com>2017-01-21 21:49:42 +0400
committerDaiki Ueno <ueno@gnu.org>2017-01-23 09:35:19 +0100
commit1e0bc1f164ce73f9feeeb14754d09072b3e9bc68 (patch)
treeefeb1d5b90467bb4462f338022c5b9cefb1b8af4
parenta4fb2bb587fb1a0146cf97f039b671d3258488f9 (diff)
Fix compiler warnings on FreeBSD
* common/compat.c: Fix "implicit declaration of function 'issetugid'" warning. On FreeBSD, it's required to define __BSD_VISIBLE to make issetugid(2) visible * common/test-message.c: Fix "implicit declaration of function 'asprintf'" by including <stdio.h> * p11-kit/test-iter.c: Fix "format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'int'" by changing format string to "%d"
-rw-r--r--common/compat.c4
-rw-r--r--common/test-message.c1
-rw-r--r--p11-kit/test-iter.c2
3 files changed, 6 insertions, 1 deletions
diff --git a/common/compat.c b/common/compat.c
index 627411e..1255b0e 100644
--- a/common/compat.c
+++ b/common/compat.c
@@ -40,6 +40,10 @@
*/
#define _XOPEN_SOURCE 700
+#if defined(HAVE_ISSETUGID) && defined(__FreeBSD__)
+#define __BSD_VISIBLE 1
+#endif
+
#include "compat.h"
#include "debug.h"
diff --git a/common/test-message.c b/common/test-message.c
index 63ecf31..7dd5426 100644
--- a/common/test-message.c
+++ b/common/test-message.c
@@ -39,6 +39,7 @@
#include <errno.h>
#include <stdlib.h>
+#include <stdio.h>
static void
test_with_err (void)
diff --git a/p11-kit/test-iter.c b/p11-kit/test-iter.c
index 3f5a76f..4ce480a 100644
--- a/p11-kit/test-iter.c
+++ b/p11-kit/test-iter.c
@@ -780,7 +780,7 @@ test_slot_match_by_id (void)
modules = initialize_and_get_modules ();
uri = p11_kit_uri_new ();
- ret = asprintf (&string, "pkcs11:slot-id=%lu", MOCK_SLOT_ONE_ID);
+ ret = asprintf (&string, "pkcs11:slot-id=%d", MOCK_SLOT_ONE_ID);
assert (ret > 0);
ret = p11_kit_uri_parse (string, P11_KIT_URI_FOR_SLOT, uri);
free (string);