diff --git a/commands/saveenv.c b/commands/saveenv.c index d28b4d3..fadd674 100644 --- a/commands/saveenv.c +++ b/commands/saveenv.c @@ -62,14 +62,15 @@ 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");