Enable 'saveenv' for non eraseable media
Juergen Beisert
jbe at pengutronix.de
Wed Nov 18 10:00:54 EST 2009
'close()' clobbers the 'errno' value from the erase command. So it must be done
*after* the check for ENOSYS to ingnore it correctly.
Signed-off by: Juergen Beisert <j.beisert at pengutronix.de>
---
commands/saveenv.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
Index: u-boot-v2/commands/saveenv.c
===================================================================
--- u-boot-v2.orig/commands/saveenv.c
+++ u-boot-v2/commands/saveenv.c
@@ -62,14 +62,15 @@ static int do_saveenv(cmd_tbl_t *cmdtp,
ret = erase(fd, ~0, 0);
- close(fd);
-
/* ENOSYS is no error here, many devices do not need it */
if (ret && errno != -ENOSYS) {
printf("could not erase %s: %s\n", filename, errno_str());
+ close(fd);
return 1;
}
+ close(fd);
+
ret = envfs_save(filename, dirname);
if (ret) {
printf("saveenv failed\n");
--
Pengutronix e.K. | Juergen Beisert |
Linux Solutions for Science and Industry | Phone: +49-8766-939 228 |
Vertretung Sued/Muenchen, Germany | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de/ |
More information about the barebox
mailing list