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: Print ???????????? if unable to get file size
Date: Mon, 14 Aug 2023 01:20:29 -0500 [thread overview]
Message-ID: <20230814062029.1859249-1-development@efficientek.com> (raw)
In long list mode, if the file can not be opened, the file is not printed.
Instead, print the file but print the size as ????????????.
Signed-off-by: Glenn Washburn <development@efficientek.com>
---
grub-core/commands/ls.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/grub-core/commands/ls.c b/grub-core/commands/ls.c
index c746eae0c7e7..6a1c7f5d3626 100644
--- a/grub-core/commands/ls.c
+++ b/grub-core/commands/ls.c
@@ -131,20 +131,20 @@ print_files_long (const char *filename, const struct grub_dirhook_info *info,
should be reported as directories. */
file = grub_file_open (pathname, GRUB_FILE_TYPE_GET_SIZE
| GRUB_FILE_TYPE_NO_DECOMPRESS);
- if (! file)
+ if (file)
{
- grub_errno = 0;
- grub_free (pathname);
- return 0;
+ if (! ctx->human)
+ grub_printf ("%-12llu", (unsigned long long) file->size);
+ else
+ grub_printf ("%-12s", grub_get_human_size (file->size,
+ GRUB_HUMAN_SIZE_SHORT));
+ grub_file_close (file);
}
-
- if (! ctx->human)
- grub_printf ("%-12llu", (unsigned long long) file->size);
else
- grub_printf ("%-12s", grub_get_human_size (file->size,
- GRUB_HUMAN_SIZE_SHORT));
- grub_file_close (file);
+ grub_xputs ("????????????");
+
grub_free (pathname);
+ grub_errno = GRUB_ERR_NONE;
}
else
grub_printf ("%-12s", _("DIR"));
--
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:21 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-14 6:20 Glenn Washburn [this message]
2023-08-14 14:13 ` [PATCH] commands/ls: Print ???????????? if unable to get file size 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=20230814062029.1859249-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.