From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH] commands: saveenv: mention where environment is saved to
Date: Mon, 14 Apr 2025 08:24:19 +0200 [thread overview]
Message-ID: <20250414062419.2724359-1-a.fatoum@pengutronix.de> (raw)
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@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
next reply other threads:[~2025-04-14 6:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-14 6:24 Ahmad Fatoum [this message]
2025-04-14 9:18 ` Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250414062419.2724359-1-a.fatoum@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox