From a68a72a7f762b0375d7868d5fac53b8d095c73da Mon Sep 17 00:00:00 2001 From: Nathan Woods Date: Mon, 12 Dec 2016 09:17:29 -0500 Subject: [PATCH] [Imgtool] Fixed a recently introduced error in the 'dir' command line command --- src/tools/imgtool/main.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/tools/imgtool/main.cpp b/src/tools/imgtool/main.cpp index f1087798c0d..79eec751834 100644 --- a/src/tools/imgtool/main.cpp +++ b/src/tools/imgtool/main.cpp @@ -179,7 +179,7 @@ static int cmd_dir(const struct command *c, int argc, char *argv[]) imgtool_dirent ent; char buf[512]; char last_modified[19]; - const char *path; + std::string path; int partition_index = 0; std::string info; @@ -193,7 +193,7 @@ static int cmd_dir(const struct command *c, int argc, char *argv[]) if (err) goto done; - path = argc > 2 ? argv[2] : nullptr; + path = argc > 2 ? argv[2] : ""; err = imgtool::directory::open(*partition, path, imgenum); if (err) @@ -204,7 +204,7 @@ static int cmd_dir(const struct command *c, int argc, char *argv[]) total_count = 0; total_size = 0; - fprintf(stdout, "Contents of %s:%s\n", argv[1], path ? path : ""); + fprintf(stdout, "Contents of %s:%s\n", argv[1], path.c_str()); info = image->info(); if (!info.empty())