2012-04-30 11:11:41

by Jaganath Kanakkassery

[permalink] [raw]
Subject: [PATCH obexd] opp: Emit TransferStarted signal only if stream start is success

Even if obex_put_stream_start() fails TransferStarted signal will be
emitted where as transfer start is actually failed.
---
plugins/opp.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/plugins/opp.c b/plugins/opp.c
index fa3ee91..c7ddc63 100644
--- a/plugins/opp.c
+++ b/plugins/opp.c
@@ -154,12 +154,15 @@ skip_auth:

path = g_build_filename(folder, name, NULL);

- manager_emit_transfer_started(os);
-
err = obex_put_stream_start(os, path);

g_free(path);

+ if (err < 0)
+ goto failed;
+
+ manager_emit_transfer_started(os);
+
failed:
g_free(folder);
g_free(name);
--
1.7.1



2012-05-02 13:13:06

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: Re: [PATCH obexd] opp: Emit TransferStarted signal only if stream start is success

Hi Jaganath,

On Mon, Apr 30, 2012 at 2:11 PM, Jaganath Kanakkassery
<[email protected]> wrote:
> Even if obex_put_stream_start() fails TransferStarted signal will be
> emitted where as transfer start is actually failed.
> ---
> ?plugins/opp.c | ? ?7 +++++--
> ?1 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/plugins/opp.c b/plugins/opp.c
> index fa3ee91..c7ddc63 100644
> --- a/plugins/opp.c
> +++ b/plugins/opp.c
> @@ -154,12 +154,15 @@ skip_auth:
>
> ? ? ? ?path = g_build_filename(folder, name, NULL);
>
> - ? ? ? manager_emit_transfer_started(os);
> -
> ? ? ? ?err = obex_put_stream_start(os, path);
>
> ? ? ? ?g_free(path);
>
> + ? ? ? if (err < 0)
> + ? ? ? ? ? ? ? goto failed;
> +
> + ? ? ? manager_emit_transfer_started(os);
> +
> ?failed:
> ? ? ? ?g_free(folder);
> ? ? ? ?g_free(name);
> --
> 1.7.1

Applied, thanks.

--
Luiz Augusto von Dentz