fix conflict with unistd.h

This commit is contained in:
yanan-rock 2021-08-10 10:21:36 +08:00
parent 87612d63f1
commit bb17433226
3 changed files with 47 additions and 106 deletions

View File

@ -1,105 +0,0 @@
From 82a1d55f20cc6977643f4c1e0efd55baec27f9a4 Mon Sep 17 00:00:00 2001
From: Brian Gix <brian.gix@intel.com>
Date: Tue, 7 Apr 2020 09:10:33 -0700
Subject: [PATCH] Exit test-mesh-crypto on any detected fail
Unit test would signal failures if run on commandline, but not if
run as part of a unit test sweep. This change forces an exit(1) on
any detected fail, and is caught by test suite runner.
https://github.com/bluez/bluez/commit/5fc60b2ce7c4370ff8d9bc3d3c3434b212465f40
---
unit/test-mesh-crypto.c | 25 +++++++++++++++++++++++--
1 file changed, 23 insertions(+), 2 deletions(-)
diff --git a/unit/test-mesh-crypto.c b/unit/test-mesh-crypto.c
index 32c46a5..08b7a87 100644
--- a/unit/test-mesh-crypto.c
+++ b/unit/test-mesh-crypto.c
@@ -660,9 +660,23 @@ static const struct mesh_crypto_test s8_6_2 = {
#define INVAL COLOR_YELLOW "INVALID" COLOR_OFF
#define EVALCMP(a, b, l) memcmp((a), (b), (l)) ? FAIL : PASS
-#define EVALSTR(a, b) (a) && (b) ? (strcmp((a), (b)) ? FAIL : PASS) : INVAL
-#define EVALNUM(a, b) a == b ? PASS : FAIL
+#define EXITCMP(a, b, l) do { if (memcmp((a), (b), (l))) \
+ exit(1); \
+ } while (0)
+
+#define EVALSTR(a, b) (((a) && (b)) ? (strcmp((a), (b)) ? FAIL : PASS) \
+ : INVAL)
+#define EXITSTR(a, b) do { if ((a) && (b)) { \
+ if (strcmp((a), (b))) \
+ exit(1); \
+ } else \
+ exit(1); \
+ } while (0)
+
+#define EVALNUM(a, b) (((a) == (b)) ? PASS : FAIL)
+#define EXITNUM(a, b) do { if (a != b) exit(1); } while (0)
#define EVALBOOLNOTBOTH(a, b) !(a && b) ? PASS : FAIL
+#define EXITBOOLNOTBOTH(a, b) do { if (!!(a && b)) exit(1); } while (0)
static void verify_data(const char *label, unsigned int indent,
const char *sample, const uint8_t *data, size_t size)
@@ -673,6 +687,7 @@ static void verify_data(const char *label, unsigned int indent,
l_info("%-20s =%*c%s", label, 1 + (indent * 2), ' ', sample);
l_info("%-20s %*c%s => %s", "", 1 + (indent * 2), ' ', str,
EVALSTR(sample, str));
+ EXITSTR(sample, str);
l_free(str);
}
@@ -684,6 +699,7 @@ static void verify_bool_not_both(const char *label, unsigned int indent,
l_info("%-20s %*c%s => %s", "", 1 + (indent * 2), ' ',
data ? "true" : "false",
EVALBOOLNOTBOTH(sample, data));
+ EXITBOOLNOTBOTH(sample, data);
}
static void verify_uint8(const char *label, unsigned int indent,
@@ -692,6 +708,7 @@ static void verify_uint8(const char *label, unsigned int indent,
l_info("%-20s =%*c%02x", label, 1 + (indent * 2), ' ', sample);
l_info("%-20s %*c%02x => %s", "", 1 + (indent * 2), ' ', data,
EVALNUM(sample, data));
+ EXITNUM(sample, data);
}
static void verify_uint16(const char *label, unsigned int indent,
@@ -700,6 +717,7 @@ static void verify_uint16(const char *label, unsigned int indent,
l_info("%-20s =%*c%04x", label, 1 + (indent * 2), ' ', sample);
l_info("%-20s %*c%04x => %s", "", 1 + (indent * 2), ' ', data,
EVALNUM(sample, data));
+ EXITNUM(sample, data);
}
static void verify_uint24(const char *label, unsigned int indent,
@@ -708,6 +726,7 @@ static void verify_uint24(const char *label, unsigned int indent,
l_info("%-20s =%*c%06x", label, 1 + (indent * 2), ' ', sample);
l_info("%-20s %*c%06x => %s", "", 1 + (indent * 2), ' ', data,
EVALNUM(sample, data));
+ EXITNUM(sample, data);
}
static void verify_uint32(const char *label, unsigned int indent,
@@ -716,6 +735,7 @@ static void verify_uint32(const char *label, unsigned int indent,
l_info("%-20s =%*c%08x", label, 1 + (indent * 2), ' ', sample);
l_info("%-20s %*c%08x => %s", "", 1 + (indent * 2), ' ', data,
EVALNUM(sample, data));
+ EXITNUM(sample, data);
}
static void verify_uint64(const char *label, unsigned int indent,
@@ -726,6 +746,7 @@ static void verify_uint64(const char *label, unsigned int indent,
l_info("%-20s %*c%16llx => %s", "", 1 + (indent * 2), ' ',
(long long unsigned int) data,
EVALNUM(sample, data));
+ EXITNUM(sample, data);
}
static void show_str(const char *label, unsigned int indent,
--
1.8.3.1

View File

@ -0,0 +1,42 @@
From 124dee151746b4a8a2e8a7194af78f2c82f75d79 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Wed, 3 Mar 2021 08:57:36 +0100
Subject: [PATCH] media: rename local function conflicting with pause(2)
profiles/audio/media.c:1284:13: error: conflicting types for 'pause'; have '_Bool(void *)'
1284 | static bool pause(void *user_data)
| ^~~~~
In file included from /usr/include/bits/sigstksz.h:24,
from /usr/include/signal.h:315,
from /usr/include/glib-2.0/glib/gbacktrace.h:36,
from /usr/include/glib-2.0/glib.h:34,
from profiles/audio/media.c:21:
/usr/include/unistd.h:478:12: note: previous declaration of 'pause' with type 'int(void)'
478 | extern int pause (void);
| ^~~~~
---
profiles/audio/media.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/profiles/audio/media.c b/profiles/audio/media.c
index c84bbe22dc..3d8c4b69c3 100644
--- a/profiles/audio/media.c
+++ b/profiles/audio/media.c
@@ -1281,7 +1281,7 @@ static bool stop(void *user_data)
return media_player_send(mp, "Stop");
}
-static bool pause(void *user_data)
+static bool pause_play(void *user_data)
{
struct media_player *mp = user_data;
@@ -1331,7 +1331,7 @@ static struct avrcp_player_cb player_cb = {
.set_volume = set_volume,
.play = play,
.stop = stop,
- .pause = pause,
+ .pause = pause_play,
.next = next,
.previous = previous,
};

View File

@ -1,7 +1,7 @@
Name: bluez
Summary: Bluetooth utilities
Version: 5.54
Release: 6
Release: 7
License: GPLv2+
URL: http://www.bluez.org/
Source0: http://www.kernel.org/pub/linux/bluetooth/bluez-%{version}.tar.xz
@ -20,6 +20,7 @@ Patch0006: backport-CVE-2021-3588.patch
# workaround for broken tests (reported upstream but not yet fixed)
# upstream:https://github.com/bluez/bluez/commit/5fc60b2ce7c4370ff8d9bc3d3c3434b212465f40
Patch0007: backport-bluez-disable-test-mesh-crypto.patch
Patch0008: backport-media-rename-local-function-conflicting-with-pause-2.patch
BuildRequires: dbus-devel >= 1.6 libell-devel >= 0.28 autoconf
BuildRequires: glib2-devel libical-devel readline-devel
@ -176,6 +177,9 @@ make check
%{_mandir}/man8/*
%changelog
* Tue Aug 10 2021 yanan <yanan@huawei.com> - 5.54-7
- DESC: fix conflict with unistd.h
* Fri Jul 30 2021 chenyanpanHW <chenyanpan@huawei.com> - 5.54-6
- DESC: delete -S git from %autosetup, and delete BuildRequires git-core