[PATCH obexd 6/6 v4] client: Remove file in case of error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

From: Luiz Augusto von Dentz <luiz.von.dentz@xxxxxxxxx>

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 5fcc35d..230f3ae 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)
+	if (transfer->op == G_OBEX_OP_GET &&
+					transfer->transferred != transfer->size)
+		remove(transfer->filename);
 	if (transfer->fd > 0)

To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Bluez Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]    [Yosemite Photos]    [Free Online Dating]     [Bluez Devel]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Devices]     [Big List of Linux Books]

Add to Google Powered by Linux