Thread (13 messages) flat view 13 messages, 3 authors, 2011-06-21

Re: [PATCH obexd 4/4] Add copy and move support for filesystem plugin

From: Johan Hedberg <hidden>
Date: 2011-06-21 08:06:30

Hi Luiz,

On Fri, Jun 17, 2011, Luiz Augusto von Dentz wrote:
From: Luiz Augusto von Dentz <redacted>

Move is implemented using rename and copy uses sendfile, both part of
posix.
---
 plugins/filesystem.c |   93 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 93 insertions(+), 0 deletions(-)
The first three patches have been pushed upstream, but could you please
fix a few things with this one:
+static int filesystem_copy(const char *name, const char *destname)
+{
+	void *in, *out;
+	ssize_t ret;
+	size_t size;
+	struct stat fstat;
+	int err;
+
+	in = filesystem_open(name, O_RDONLY, 0, NULL, &size, &err);
+	if (in == NULL) {
+		error("open(%s): %s (%d)", name, strerror(-err), -err);
+		return -err;
+	}
Could you create local int type variables here (in_fd and out_fd) so
that it's clear what filesystem_open has returned and you don't need to
do the GPOINTER_TO_INT cast in every place.
+	ret = stat(name, &fstat);
Since you already have the fd, please use fstat instead.

Johan
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help