diff options
Diffstat (limited to 'commands/saveenv.c')
-rw-r--r-- | commands/saveenv.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/commands/saveenv.c b/commands/saveenv.c index 43f16dc490..6f210b7ec1 100644 --- a/commands/saveenv.c +++ b/commands/saveenv.c @@ -27,7 +27,7 @@ static int do_saveenv(int argc, char *argv[]) { int ret, opt; unsigned envfs_flags = 0; - char *filename, *dirname; + char *filename = NULL, *dirname = NULL; printf("saving environment\n"); while ((opt = getopt(argc, argv, "z")) > 0) { @@ -39,15 +39,11 @@ static int do_saveenv(int argc, char *argv[]) } /* destination and source are given? */ - if (argc - optind < 2) - dirname = "/env"; - else + if (argc - optind > 1) dirname = argv[optind + 1]; /* destination only given? */ - if (argc - optind < 1) - filename = default_environment_path_get(); - else + if (argc - optind > 0) filename = argv[optind]; ret = envfs_save(filename, dirname, envfs_flags); |