diff options
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"); |