From d8cbc6820f8f990f284a6d9a882bc455449b0eba Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Fri, 3 Jul 2009 16:19:00 +0300 Subject: [PATCH] obexd: Add proper error logs for os_prepare_get failures --- obexd/src/obex.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/obexd/src/obex.c b/obexd/src/obex.c index 490b537d8..4f5d722b7 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; } -- 2.47.3