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
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;
return 0;
fail:
- err = -errno;
if (fd >= 0)
close(fd);
-
return err;
}