grub2/0305-grub-set-bootflag-Print-an-error-if-failing-to-read-.patch
Javier Martinez Canillas 04d38248e3
A set of fixes mostly BLS related
Fix --bls-directory option comment in grub2-switch-to-blscfg man page
  Resolves: rhbz#1714835
10_linux_bls: use '=' to separate --id argument due a Petitboot bug
grub-set-bootflag: Print an error if failing to read from grubenv
  Resolves: rhbz#1702354
10_linux: generate BLS section even if no kernels are found in /boot
10_linux: don't search for OSTree kernels

Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
2019-06-27 17:27:11 +02:00

40 lines
1.2 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Javier Martinez Canillas <javierm@redhat.com>
Date: Thu, 20 Jun 2019 13:26:31 +0200
Subject: [PATCH] grub-set-bootflag: Print an error if failing to read from
grubenv
If the tool fails to read the grubenv file, it prints the following error:
Error reading from /boot/grub2/grubenv: Success
This is confusing for users, so instead print a proper error message.
Resolves: rhbz#1702354
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
---
util/grub-set-bootflag.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/util/grub-set-bootflag.c b/util/grub-set-bootflag.c
index 20062fe802b..6a79ee67444 100644
--- a/util/grub-set-bootflag.c
+++ b/util/grub-set-bootflag.c
@@ -27,6 +27,7 @@
#include <grub/types.h>
#include <grub/err.h>
#include <grub/lib/envblk.h> /* For GRUB_ENVBLK_DEFCFG define */
+#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
@@ -87,6 +88,7 @@ int main(int argc, char *argv[])
fclose (f);
if (ret != GRUBENV_SIZE)
{
+ errno = EINVAL;
perror ("Error reading from " GRUBENV);
return 1;
}