bug-grub
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 1/3] util/grub-file: Fix error message on --version


From: Lukas Fink
Subject: [PATCH 1/3] util/grub-file: Fix error message on --version
Date: Sun, 30 Aug 2020 02:43:40 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0

Hello,

I found a few bugs in the grub-file utility and the corresponding
command.

The first is that "grub-file --version" prints an error message:
grub-file (GRUB) 2.04
error: unknown argument `--version'.

The attached patch fixes this.

Greetings

Lukas Fink


>From b28668524b091fd4a49af2ca47007e420f25dba0 Mon Sep 17 00:00:00 2001
From: Lukas Fink <lukas.fink1@gmail.com>
Date: Sat, 29 Aug 2020 22:34:17 +0200
Subject: [PATCH 1/3] util/grub-file: Fix error message on --version

grub-file now exits after printing its version, therefore avoiding to
print an unknown argument error message.
---
 util/grub-file.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/util/grub-file.c b/util/grub-file.c
index b2e7dd69f..39f972575 100644
--- a/util/grub-file.c
+++ b/util/grub-file.c
@@ -54,13 +54,14 @@ main (int argc, char *argv[])
 
   grub_util_host_init (&argc, &argv);
 
-  argv2 = xcalloc (argc, sizeof (argv2[0]));
-
   if (argc == 2 && strcmp (argv[1], "--version") == 0)
     {
       printf ("%s (%s) %s\n", program_name, PACKAGE_NAME, PACKAGE_VERSION);
+      return 0;
     }
 
+  argv2 = xcalloc (argc, sizeof (argv2[0]));
+
   for (i = 1; i < argc; i++)
     {
       if (argv[i][0] == '-' && argv[i][1] == '-'
-- 
2.28.0





reply via email to

[Prev in Thread] Current Thread [Next in Thread]