diff options
author | Juergen Beisert <jbe@pengutronix.de> | 2009-11-18 16:00:54 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2009-11-19 09:42:38 +0100 |
commit | 3173b1fb08fa9f2a8b197b676daa773607e475d9 (patch) | |
tree | 8ed988d008e234b40d1ee0fc232763c349b7a59e /commands | |
parent | b00a6d357e04dc04b728bb58daeeafa1ee718d09 (diff) | |
download | barebox-3173b1fb08fa9f2a8b197b676daa773607e475d9.tar.gz barebox-3173b1fb08fa9f2a8b197b676daa773607e475d9.tar.xz |
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>
Diffstat (limited to 'commands')
-rw-r--r-- | commands/saveenv.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/commands/saveenv.c b/commands/saveenv.c index d28b4d338c..fadd6747f6 100644 --- a/commands/saveenv.c +++ b/commands/saveenv.c @@ -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"); |