For arguments that are paths to files, print the full path of the file. Signed-off-by: Glenn Washburn <developm...@efficientek.com> --- grub-core/commands/ls.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/grub-core/commands/ls.c b/grub-core/commands/ls.c index e33c16158d63..384d3e3cede8 100644 --- a/grub-core/commands/ls.c +++ b/grub-core/commands/ls.c @@ -98,6 +98,7 @@ static int print_file (const char *filename, const struct grub_dirhook_info *info, void *data) { + char *pathname = NULL; struct grub_ls_list_files_ctx *ctx = data; if ((! ctx->all) && (filename[0] == '.')) @@ -117,7 +118,6 @@ print_file (const char *filename, const struct grub_dirhook_info *info, if (! info->dir) { grub_file_t file; - char *pathname; if (ctx->dirname[grub_strlen (ctx->dirname) - 1] == '/') pathname = grub_xasprintf ("%s%s", ctx->dirname, filename); @@ -143,7 +143,6 @@ print_file (const char *filename, const struct grub_dirhook_info *info, else grub_xputs ("????????????"); - grub_free (pathname); grub_errno = GRUB_ERR_NONE; } else @@ -165,7 +164,10 @@ print_file (const char *filename, const struct grub_dirhook_info *info, datetime.day, datetime.hour, datetime.minute, datetime.second); } - grub_printf ("%s%s\n", filename, info->dir ? "/" : ""); + grub_printf ("%s%s\n", (ctx->filename) ? pathname : filename, + info->dir ? "/" : ""); + + grub_free (pathname); return 0; } -- 2.34.1 _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel