2019-04-30 09:45:55

by Michał Lowas-Rzechonek

[permalink] [raw]
Subject: [PATCH] a2dp: Fixed warn_unused_result warning

This used to break builds when using maintainer mode via
./bootstrap-configure
---
profiles/audio/a2dp.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/profiles/audio/a2dp.c b/profiles/audio/a2dp.c
index 8f141739c..5f5ad508d 100644
--- a/profiles/audio/a2dp.c
+++ b/profiles/audio/a2dp.c
@@ -1772,8 +1772,15 @@ static void register_remote_sep(void *data, void *user_data)
if (!(g_dbus_get_flags() & G_DBUS_FLAG_ENABLE_EXPERIMENTAL))
goto done;

- asprintf(&sep->path, "%s/sep%d", device_get_path(chan->device),
- avdtp_get_seid(rsep));
+ if (asprintf(&sep->path, "%s/sep%d",
+ device_get_path(chan->device),
+ avdtp_get_seid(rsep)) < 0) {
+ error("Could not allocate path for remote sep %s/sep%d",
+ device_get_path(chan->device),
+ avdtp_get_seid(rsep));
+ sep->path = NULL;
+ goto done;
+ }

if (g_dbus_register_interface(btd_get_dbus_connection(),
sep->path, MEDIA_ENDPOINT_INTERFACE,
--
2.19.1


2019-04-30 09:48:05

by Von Dentz, Luiz

[permalink] [raw]
Subject: Re: [PATCH] a2dp: Fixed warn_unused_result warning

Hi Michał,

On Tue, Apr 30, 2019 at 12:45 PM Michał Lowas-Rzechonek
<[email protected]> wrote:
>
> This used to break builds when using maintainer mode via
> ./bootstrap-configure

Thanks, could you include the compiler error in the commit message.

> ---
> profiles/audio/a2dp.c | 11 +++++++++--
> 1 file changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/profiles/audio/a2dp.c b/profiles/audio/a2dp.c
> index 8f141739c..5f5ad508d 100644
> --- a/profiles/audio/a2dp.c
> +++ b/profiles/audio/a2dp.c
> @@ -1772,8 +1772,15 @@ static void register_remote_sep(void *data, void *user_data)
> if (!(g_dbus_get_flags() & G_DBUS_FLAG_ENABLE_EXPERIMENTAL))
> goto done;
>
> - asprintf(&sep->path, "%s/sep%d", device_get_path(chan->device),
> - avdtp_get_seid(rsep));
> + if (asprintf(&sep->path, "%s/sep%d",
> + device_get_path(chan->device),
> + avdtp_get_seid(rsep)) < 0) {
> + error("Could not allocate path for remote sep %s/sep%d",
> + device_get_path(chan->device),
> + avdtp_get_seid(rsep));
> + sep->path = NULL;
> + goto done;
> + }
>
> if (g_dbus_register_interface(btd_get_dbus_connection(),
> sep->path, MEDIA_ENDPOINT_INTERFACE,
> --
> 2.19.1
>