9
0
Fork 0

Enable 'saveenv' for non eraseable media

'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@pengutronix.de>

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Juergen Beisert 2009-11-18 16:00:54 +01:00 committed by Sascha Hauer
parent b00a6d357e
commit 3173b1fb08
1 changed files with 3 additions and 2 deletions

View File

@ -62,14 +62,15 @@ static int do_saveenv(cmd_tbl_t *cmdtp, int argc, char *argv[])
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");