Diff between 4f8d077fb56d4e018f718627b3d732dbadfaf313 and d8cbc6820f8f990f284a6d9a882bc455449b0eba

Changed Files

File Additions Deletions Status
obexd/src/obex.c +9 -4 modified

Full Patch

diff --git a/obexd/src/obex.c b/obexd/src/obex.c
index 490b537..4f5d722 100644
--- a/obexd/src/obex.c
+++ b/obexd/src/obex.c
@@ -441,11 +441,18 @@ int os_prepare_get(struct obex_session *os, gchar *file, guint32 *size)
 	struct stat stats;
 
 	fd = open(file, O_RDONLY);
-	if (fd < 0)
+	if (fd < 0) {
+		err = -errno;
+		error("open(%s): %s (%d)", file, strerror(errno), errno);
 		goto fail;
+	}
 
-	if (fstat(fd, &stats))
+	if (fstat(fd, &stats) < 0) {
+		err = -errno;
+		error("fstat(fd=%d (%s)): %s (%d)", fd, file,
+						strerror(errno), errno);
 		goto fail;
+	}
 
 	os->fd = fd;
 	os->offset = 0;
@@ -458,10 +465,8 @@ int os_prepare_get(struct obex_session *os, gchar *file, guint32 *size)
 	return 0;
 
 fail:
-	err = -errno;
 	if (fd >= 0)
 		close(fd);
-
 	return err;
 }