From: Luotao Fu <l.fu@pengutronix.de>
To: sha@pengutronix.de
Cc: barebox@lists.infradead.org, Luotao Fu <l.fu@pengutronix.de>
Subject: [PATCH 1/5] fix error return value while loading environment
Date: Fri, 26 Mar 2010 13:52:25 +0100 [thread overview]
Message-ID: <1269607949-5336-2-git-send-email-l.fu@pengutronix.de> (raw)
In-Reply-To: <1269607949-5336-1-git-send-email-l.fu@pengutronix.de>
Signed-off-by: Luotao Fu <l.fu@pengutronix.de>
---
common/environment.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/common/environment.c b/common/environment.c
index 0c7de84..0eb7e6b 100644
--- a/common/environment.c
+++ b/common/environment.c
@@ -198,6 +198,7 @@ int envfs_load(char *filename, char *dir)
if (crc32(0, (unsigned char *)&super, sizeof(struct envfs_super) - 4)
!= ENVFS_32(super.sb_crc)) {
printf("wrong crc on env superblock\n");
+ ret = -EIO;
goto out;
}
@@ -207,18 +208,20 @@ int envfs_load(char *filename, char *dir)
ret = read(envfd, buf, size);
if (ret < size) {
perror("read");
+ ret = errno;
goto out;
}
if (crc32(0, (unsigned char *)buf, size)
!= ENVFS_32(super.crc)) {
printf("wrong crc on env\n");
+ ret = -EIO;
goto out;
}
while (size) {
struct envfs_inode *inode;
- uint32_t inode_size,inode_namelen;
+ uint32_t inode_size, inode_namelen;
inode = (struct envfs_inode *)buf;
@@ -251,6 +254,7 @@ int envfs_load(char *filename, char *dir)
inode_size);
if (ret < inode_size) {
perror("write");
+ ret = errno;
close(fd);
goto out;
}
--
1.7.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2010-03-26 12:53 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-26 12:52 Environment handling fixes and support for multiple environment backends Luotao Fu
2010-03-26 12:52 ` Luotao Fu [this message]
2010-03-26 12:52 ` [PATCH 2/5] crc value handling and dry run mode in envfs_load Luotao Fu
2010-03-26 12:52 ` [PATCH 3/5] add multi environment support Luotao Fu
2010-03-26 12:52 ` [PATCH 4/5] Add multi env support to saveenv and loadenv commands Luotao Fu
2010-03-26 12:52 ` [PATCH 5/5] add general check_and_erase callback to environment handling Luotao Fu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1269607949-5336-2-git-send-email-l.fu@pengutronix.de \
--to=l.fu@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=sha@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox