linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH obexd 1/3] client: Fix opening file in obc_transfer_get
@ 2011-12-16 13:23 Bartosz Szatkowski
  2011-12-16 13:23 ` [PATCH obexd 2/3] client: Add file flexibility for GET Bartosz Szatkowski
  2011-12-16 13:23 ` [PATCH obexd 3/3] map: Add basic GetMessage support Bartosz Szatkowski
  0 siblings, 2 replies; 4+ messages in thread
From: Bartosz Szatkowski @ 2011-12-16 13:23 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Bartosz Szatkowski

Until now file was opened, but not truncated - resulting in garbage on
the end of file in situations when new content was shorter then old one.
---
 client/transfer.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/client/transfer.c b/client/transfer.c
index c481378..472a04d 100644
--- a/client/transfer.c
+++ b/client/transfer.c
@@ -516,7 +516,7 @@ int obc_transfer_get(struct obc_transfer *transfer, transfer_callback_t func,
 		rsp_cb = get_buf_xfer_progress;
 	} else {
 		int fd = open(transfer->name ? : transfer->filename,
-				O_WRONLY | O_CREAT, 0600);
+				O_WRONLY | O_CREAT | O_TRUNC, 0600);
 
 		if (fd < 0) {
 			error("open(): %s(%d)", strerror(errno), errno);
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-12-16 14:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-16 13:23 [PATCH obexd 1/3] client: Fix opening file in obc_transfer_get Bartosz Szatkowski
2011-12-16 13:23 ` [PATCH obexd 2/3] client: Add file flexibility for GET Bartosz Szatkowski
2011-12-16 13:23 ` [PATCH obexd 3/3] map: Add basic GetMessage support Bartosz Szatkowski
2011-12-16 14:23   ` Johan Hedberg

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).