summaryrefslogtreecommitdiff
path: root/nuttx/binfmt/libnxflat/libnxflat_read.c
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-10-25 03:13:11 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-10-25 03:13:11 +0000
commitcb3be8c6e6920198440d9654f05b122853724868 (patch)
treea018506cf7763c9e12ab56b1b81d9677b97264f6 /nuttx/binfmt/libnxflat/libnxflat_read.c
parent087d2899c1a9f80de11b569d57862c7be8a92974 (diff)
downloadpx4-nuttx-cb3be8c6e6920198440d9654f05b122853724868.tar.gz
px4-nuttx-cb3be8c6e6920198440d9654f05b122853724868.tar.bz2
px4-nuttx-cb3be8c6e6920198440d9654f05b122853724868.zip
A little more ELF loader logic
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5256 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/binfmt/libnxflat/libnxflat_read.c')
-rw-r--r--nuttx/binfmt/libnxflat/libnxflat_read.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/nuttx/binfmt/libnxflat/libnxflat_read.c b/nuttx/binfmt/libnxflat/libnxflat_read.c
index da05bc399..8deeb0805 100644
--- a/nuttx/binfmt/libnxflat/libnxflat_read.c
+++ b/nuttx/binfmt/libnxflat/libnxflat_read.c
@@ -129,8 +129,9 @@ int nxflat_read(struct nxflat_loadinfo_s *loadinfo, char *buffer, int readsize,
rpos = lseek(loadinfo->filfd, offset, SEEK_SET);
if (rpos != offset)
{
- bdbg("Failed to seek to position %d: %d\n", offset, errno);
- return -errno;
+ int errval = errno;
+ bdbg("Failed to seek to position %d: %d\n", offset, errval);
+ return -errval;
}
/* Read the file data at offset into the user buffer */
@@ -138,10 +139,11 @@ int nxflat_read(struct nxflat_loadinfo_s *loadinfo, char *buffer, int readsize,
nbytes = read(loadinfo->filfd, bufptr, bytesleft);
if (nbytes < 0)
{
- if (errno != EINTR)
+ int errval = errno;
+ if (errval != EINTR)
{
- bdbg("Read of .data failed: %d\n", errno);
- return -errno;
+ bdbg("Read of .data failed: %d\n", errval);
+ return -errval;
}
}
else if (nbytes == 0)