From: Glenn Washburn <development@efficientek.com>
To: grub-devel@gnu.org, Daniel Kiper <dkiper@net-space.pl>
Cc: Glenn Washburn <development@efficientek.com>
Subject: [PATCH] commands/ls: Send correct dirname to print funcions
Date: Mon, 14 Aug 2023 01:16:53 -0500 [thread overview]
Message-ID: <20230814061653.1859106-1-development@efficientek.com> (raw)
For each non-directory path argument to the ls command, the full path was
being sent to the print functions, instead of the dirname. The long output
print function expected dirname to be the directory containing the file
and so could not open the file to get the file size because the generated
path was incorrect. This caused the output to be a blank line.
Signed-off-by: Glenn Washburn <development@efficientek.com>
---
grub-core/commands/ls.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/grub-core/commands/ls.c b/grub-core/commands/ls.c
index 8e98c73ccf7b..c746eae0c7e7 100644
--- a/grub-core/commands/ls.c
+++ b/grub-core/commands/ls.c
@@ -242,8 +242,8 @@ grub_ls_list_files (char *dirname, int longlist, int all, int human)
grub_file_close (file);
p = grub_strrchr (dirname, '/') + 1;
- dirname = grub_strndup (dirname, p - dirname);
- if (! dirname)
+ ctx.dirname = grub_strndup (dirname, p - dirname);
+ if (ctx.dirname == NULL)
goto fail;
all = 1;
@@ -253,7 +253,7 @@ grub_ls_list_files (char *dirname, int longlist, int all, int human)
else
print_files (p, &info, &ctx);
- grub_free (dirname);
+ grub_free (ctx.dirname);
}
if (grub_errno == GRUB_ERR_NONE)
--
2.34.1
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel
next reply other threads:[~2023-08-14 6:17 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-14 6:16 Glenn Washburn [this message]
2023-08-14 14:10 ` [PATCH] commands/ls: Send correct dirname to print funcions Daniel Kiper
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=20230814061653.1859106-1-development@efficientek.com \
--to=development@efficientek.com \
--cc=dkiper@net-space.pl \
--cc=grub-devel@gnu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.