unit: prevent unintended use of glibc's error(3)

When building the test-sdp we don't want src/sdpd-request.c end up
using the incompatible GNU libc's error(3) instead of the intended
src/log.c's error().

This also fixes the following compile error on Alpine Linux with musl
libc which does not implement the error(3) GNU extension:

src/sdpd-request.o: In function `extract_des':
/home/ncopa/src/bluez/src/sdpd-request.c:126: undefined reference to `error'
src/sdpd-request.o: In function `process_request':
/home/ncopa/src/bluez/src/sdpd-request.c:1022: undefined reference to `error'
/home/ncopa/src/bluez/src/sdpd-request.c:1045: undefined reference to `error'
This commit is contained in:
Natanael Copa 2014-03-14 09:59:26 +00:00 committed by Johan Hedberg
parent 18f0cdaac1
commit becfb84742
2 changed files with 5 additions and 6 deletions

View File

@ -265,6 +265,7 @@ unit_tests += unit/test-sdp
unit_test_sdp_SOURCES = unit/test-sdp.c \
src/shared/util.h src/shared/util.c \
src/sdpd.h src/sdpd-database.c \
src/log.h src/log.c \
src/sdpd-service.c src/sdpd-request.c
unit_test_sdp_LDADD = lib/libbluetooth-internal.la @GLIB_LIBS@

View File

@ -37,6 +37,7 @@
#include "lib/sdp_lib.h"
#include "src/shared/util.h"
#include "src/log.h"
#include "src/sdpd.h"
struct sdp_pdu {
@ -128,12 +129,6 @@ static void sdp_debug(const char *str, void *user_data)
g_print("%s%s\n", prefix, str);
}
void btd_debug(const char *format, ...);
void btd_debug(const char *format, ...)
{
}
static void context_quit(struct context *context)
{
g_main_loop_quit(context->main_loop);
@ -797,6 +792,9 @@ int main(int argc, char *argv[])
{
g_test_init(&argc, &argv, NULL);
if (g_test_verbose())
__btd_log_init("*", 0);
/*
* Service Search Request
*