nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

Blame SOURCES/0029-grub-core-disk-ieee1275-ofdisk.c-scan-Check-function.patch

f96e0b
From 41596a656df83fe0bd72944b711c127c68d28a94 Mon Sep 17 00:00:00 2001
f96e0b
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
f96e0b
Date: Wed, 5 Sep 2012 08:56:08 +0200
f96e0b
Subject: [PATCH 029/482] 	* grub-core/disk/ieee1275/ofdisk.c (scan):
f96e0b
 Check function return value. 	* grub-core/lib/ieee1275/datetime.c
f96e0b
 (grub_get_datetime): Likewise. 	(grub_set_datetime): Likewise.
f96e0b
f96e0b
---
f96e0b
 ChangeLog                         | 6 ++++++
f96e0b
 grub-core/disk/ieee1275/ofdisk.c  | 2 +-
f96e0b
 grub-core/lib/ieee1275/datetime.c | 4 ++--
f96e0b
 3 files changed, 9 insertions(+), 3 deletions(-)
f96e0b
f96e0b
diff --git a/ChangeLog b/ChangeLog
f96e0b
index 66a0245..ff982b3 100644
f96e0b
--- a/ChangeLog
f96e0b
+++ b/ChangeLog
f96e0b
@@ -1,5 +1,11 @@
f96e0b
 2012-09-05  Vladimir Serbinenko  <phcoder@gmail.com>
f96e0b
 
f96e0b
+	* grub-core/disk/ieee1275/ofdisk.c (scan): Check function return value.
f96e0b
+	* grub-core/lib/ieee1275/datetime.c (grub_get_datetime): Likewise.
f96e0b
+	(grub_set_datetime): Likewise.
f96e0b
+
f96e0b
+2012-09-05  Vladimir Serbinenko  <phcoder@gmail.com>
f96e0b
+
f96e0b
 	* grub-core/script/yylex.l: Ignore unused-function and sign-compare
f96e0b
 	warnings.
f96e0b
 
f96e0b
diff --git a/grub-core/disk/ieee1275/ofdisk.c b/grub-core/disk/ieee1275/ofdisk.c
f96e0b
index b0aa7ec..c9535a0 100644
f96e0b
--- a/grub-core/disk/ieee1275/ofdisk.c
f96e0b
+++ b/grub-core/disk/ieee1275/ofdisk.c
f96e0b
@@ -178,7 +178,7 @@ scan (void)
f96e0b
 	args.table = 0;
f96e0b
 	args.nentries = 0;
f96e0b
 
f96e0b
-	if (IEEE1275_CALL_ENTRY_FN (&args) == -1)
f96e0b
+	if (IEEE1275_CALL_ENTRY_FN (&args) == -1 || args.catch_result)
f96e0b
 	  {
f96e0b
 	    grub_ieee1275_close (ihandle);
f96e0b
 	    return 0;
f96e0b
diff --git a/grub-core/lib/ieee1275/datetime.c b/grub-core/lib/ieee1275/datetime.c
f96e0b
index 1947135..8792429 100644
f96e0b
--- a/grub-core/lib/ieee1275/datetime.c
f96e0b
+++ b/grub-core/lib/ieee1275/datetime.c
f96e0b
@@ -89,7 +89,7 @@ grub_get_datetime (struct grub_datetime *datetime)
f96e0b
 
f96e0b
   grub_ieee1275_close (ihandle);
f96e0b
 
f96e0b
-  if (status == -1)
f96e0b
+  if (status == -1 || args.catch_result)
f96e0b
     return grub_error (GRUB_ERR_IO, "get-time failed");
f96e0b
 
f96e0b
   datetime->year = args.year;
f96e0b
@@ -148,7 +148,7 @@ grub_set_datetime (struct grub_datetime *datetime)
f96e0b
 
f96e0b
   grub_ieee1275_close (ihandle);
f96e0b
 
f96e0b
-  if (status == -1)
f96e0b
+  if (status == -1 || args.catch_result)
f96e0b
     return grub_error (GRUB_ERR_IO, "set-time failed");
f96e0b
 
f96e0b
   return GRUB_ERR_NONE;
f96e0b
-- 
f96e0b
1.8.2.1
f96e0b