From cb3be8c6e6920198440d9654f05b122853724868 Mon Sep 17 00:00:00 2001 From: patacongo Date: Thu, 25 Oct 2012 03:13:11 +0000 Subject: A little more ELF loader logic git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5256 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/binfmt/libnxflat/libnxflat_read.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'nuttx/binfmt/libnxflat/libnxflat_read.c') 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) -- cgit v1.2.3