From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH obexd 6/6] client: Remove file in case of error
Date: Thu, 19 Apr 2012 17:06:28 +0300 [thread overview]
Message-ID: <1334844388-7121-6-git-send-email-luiz.dentz@gmail.com> (raw)
In-Reply-To: <1334844388-7121-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
If the transfer operation is GET and it has not complete by the time its
freed remove the file as its contents maybe corrupted/incomplete.
---
client/transfer.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/client/transfer.c b/client/transfer.c
index 7a6d331..1cc2b36 100644
--- a/client/transfer.c
+++ b/client/transfer.c
@@ -196,6 +196,10 @@ static void obc_transfer_free(struct obc_transfer *transfer)
if (transfer->xfer)
g_obex_cancel_transfer(transfer->xfer);
+ if (transfer->op == G_OBEX_OP_GET &&
+ transfer->transferred != transfer->size)
+ remove(transfer->filename);
+
if (transfer->fd > 0)
close(transfer->fd);
--
1.7.7.6
prev parent reply other threads:[~2012-04-19 14:06 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-19 14:06 [PATCH obexd 1/6] client: Remove buffer based transfer Luiz Augusto von Dentz
2012-04-19 14:06 ` [PATCH obexd 2/6] client: remove unused field Luiz Augusto von Dentz
2012-04-19 14:06 ` [PATCH obexd 3/6] client: transfer api merges put and get Luiz Augusto von Dentz
2012-04-19 14:06 ` [PATCH obexd 4/6] client: transfers take gobex when starting Luiz Augusto von Dentz
2012-04-19 14:06 ` [PATCH obexd 5/6] client: open file during transfer creation Luiz Augusto von Dentz
2012-04-19 14:06 ` Luiz Augusto von Dentz [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1334844388-7121-6-git-send-email-luiz.dentz@gmail.com \
--to=luiz.dentz@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).