Diff between ba365020b9f52bb20a23c4d92199bc1bc0429f69 and dc659692881378cd174593c63a5675b2baba7c71

Changed Files

File Additions Deletions Status
obexd/plugins/filesystem.c +6 -2 modified
obexd/src/obex.c +2 -2 modified

Full Patch

diff --git a/obexd/plugins/filesystem.c b/obexd/plugins/filesystem.c
index 6660b58..ae7ceea 100644
--- a/obexd/plugins/filesystem.c
+++ b/obexd/plugins/filesystem.c
@@ -138,14 +138,18 @@ static gpointer filesystem_open(const char *name, int oflag, mode_t mode,
 	}
 
 	if (oflag == O_RDONLY) {
-		*size =  stats.st_size;
+		if (size)
+			*size =  stats.st_size;
 		return GINT_TO_POINTER(fd);
 	}
 
 	if (fstatvfs(fd, &buf) < 0)
 		goto failed;
 
-	if (buf.f_bsize * buf.f_bavail < *size) {
+	if (size == NULL)
+		return GINT_TO_POINTER(fd);
+
+	if (buf.f_bsize * buf.f_bavail < (size_t) *size) {
 		errno = ENOSPC;
 		goto failed;
 	}
diff --git a/obexd/src/obex.c b/obexd/src/obex.c
index 192b3dd..d0afc18 100644
--- a/obexd/src/obex.c
+++ b/obexd/src/obex.c
@@ -467,9 +467,9 @@ gint os_prepare_put(struct obex_session *os)
 	gint len;
 
 	path = g_build_filename(os->current_folder, os->name, NULL);
-
 	os->object = os->driver->open(path, O_WRONLY | O_CREAT | O_TRUNC, 0600,
-					(size_t *) &os->size);
+					os->size != OBJECT_SIZE_UNKNOWN ?
+					(size_t *) &os->size : NULL);
 	if (os->object == NULL) {
 		error("open(%s): %s (%d)", path, strerror(errno), errno);
 		g_free(path);