[PATCH] commands: saveenv: mention where environment is saved to
Ahmad Fatoum
a.fatoum at pengutronix.de
Sun Apr 13 23:24:19 PDT 2025
We already mention it on loadenv, but it makes sense to do it on saveenv
too to assist with debugging.
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
commands/saveenv.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/commands/saveenv.c b/commands/saveenv.c
index 203729efbb1a..d8aeb31f051c 100644
--- a/commands/saveenv.c
+++ b/commands/saveenv.c
@@ -13,9 +13,8 @@ static int do_saveenv(int argc, char *argv[])
{
int ret, opt;
unsigned envfs_flags = 0;
- char *filename = NULL, *dirname = NULL;
+ const char *filename = NULL, *dirname = NULL;
- printf("saving environment\n");
while ((opt = getopt(argc, argv, "z")) > 0) {
switch (opt) {
case 'z':
@@ -33,6 +32,12 @@ static int do_saveenv(int argc, char *argv[])
/* destination only given? */
if (argc - optind > 0)
filename = argv[optind];
+ if (!filename)
+ filename = default_environment_path_get();
+ if (!filename)
+ return -ENOENT;
+
+ printf("saving environment to %s\n", filename);
ret = envfs_save(filename, dirname, envfs_flags);
--
2.39.5
More information about the barebox
mailing list