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:
parent
b00a6d357e
commit
3173b1fb08
|
@ -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");
|
||||
|
|
Loading…
Reference in New Issue