Merge pull request #1829 from npwoods/imgtool_dir_bug_fix

[Imgtool] Fixed a recently introduced error in the 'dir' command line command
This commit is contained in:
R. Belmont 2016-12-13 10:37:56 -05:00 committed by GitHub
commit 0a61f0be8b

View File

@ -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())