File efibootmgr-0.5.4-catchup.diff of Package efibootmgr

---
 Makefile                    |    2 -
 doc/ChangeLog               |   66 ++++++++++++++++++++++++++++++++++++++++++++
 src/efibootmgr/efibootmgr.c |    9 +++++-
 src/include/efi.h           |    2 +
 src/lib/disk.c              |    1 
 src/lib/efivars_sysfs.c     |    4 ++
 src/lib/gpt.c               |    6 ++--
 src/man/man8/efibootmgr.8   |   10 ++++--
 8 files changed, 92 insertions(+), 8 deletions(-)

--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -1,3 +1,69 @@
+commit de0ca446e7e5439306f7f54806d1a15310588426
+Author: Jordan Hargrave <Jordan_Hargrave@dell.com>
+Date:   Thu Nov 29 10:11:43 2012 -0600
+
+    Add patches from fedora release
+    * Wed Nov 28 2012 Matthew Garrett <mjg59@srcf.ucam.org> - 0.5.4-14
+    - efibootmgr-0.5.4-Work-around-broken-Apple-firmware.patch
+      Resolves: #873629
+    - efibootmgr-0.5.4-Remove-device-path-padding-on-non-Itanium.patch - improve
+      spec conformance
+
+commit 9392250bd8668ef7544530d17800dc0271cd8bf3
+Author: Jordan Hargrave <Jordan_Hargrave@dell.com>
+Date:   Tue Apr 24 12:58:57 2012 -0500
+
+    From: Lane Winner<lane.winner@oracle.com>
+    
+    make_boot_var does not check for failed status with create_variable.
+    This can result in a memory leak.
+    Additionally the user should be notified of the problem.
+    
+    We encounter this issue on one system after filling up the UEFI boot list
+    with dummy devices.
+    
+    The patch fix the problem. It was verified on a Mensa system using RHEL 6.0
+    
+    Signed-off-by: Yinghai Lu<yinghai@kernel.org>
+
+commit 8602b3c41701572669b1f8b9c45409d98405eca2
+Author: Peter Jones <pjones@redhat.com>
+Date:   Wed Jul 14 11:26:49 2010 -0700
+
+    Handle sector_size != 512.
+    
+    Disks can have 4kB sectors now, so don't just bail out when that's the
+    case.
+
+commit fb3d9a8d9bfd580d23b14b384a393510e0a749ac
+Author: Matt Domsch <Matt_Domsch@dell.com>
+Date:   Thu Jul 23 14:20:19 2009 -0500
+
+    fix disk minor number discovery
+    
+    Raymund Will noted disk_info_from_fd() incorrectly used logical &&
+    instead of bitwise & when obtaining the minor number.
+    
+    Reported in https://bugzilla.novell.com/show_bug.cgi?id=524529#c1
+
+commit acac7412e8e0819fc66cdadc06ad4ca535f29b35
+Author: Matt Domsch <Matt_Domsch@dell.com>
+Date:   Thu Jul 23 14:18:11 2009 -0500
+
+    fix minor memory leak
+    
+    David Binderman noted new_data was being allocated but not freed.  Not
+    a big deal as the program exits soon thereafter (and is thus freed),
+    but worth fixing anyhow.
+    
+    Fixes https://bugzilla.novell.com/show_bug.cgi?id=524529#c1
+
+commit c8d6ceaa7b33f952bcf32bc017ce8b5d7d659267
+Author: Matt Domsch <Matt_Domsch@dell.com>
+Date:   Fri Jan 11 15:09:12 2008 -0600
+
+    update ChangeLog
+
 commit 6e6bf6fc7665851798a6c2c92893ebb629e42aff
 Author: Matt Domsch <Matt_Domsch@dell.com>
 Date:   Fri Jan 11 15:08:12 2008 -0600
--- a/src/efibootmgr/efibootmgr.c
+++ b/src/efibootmgr/efibootmgr.c
@@ -239,6 +239,7 @@ warn_duplicate_name(list_t *boot_list)
 static var_entry_t *
 make_boot_var(list_t *boot_list)
 {
+	efi_status_t status;
 	var_entry_t *boot;
 	int free_number;
 	list_t *pos;
@@ -271,7 +272,12 @@ make_boot_var(list_t *boot_list)
 		free(boot);
 		return NULL;
 	}
-	create_variable(&boot->var_data);
+
+	status = create_variable(&boot->var_data);
+	if (status != EFI_SUCCESS) {
+		free(boot);
+		return NULL;
+	}
 	list_add_tail(&boot->list, boot_list);
 	return boot;
 }
@@ -328,6 +334,7 @@ add_to_boot_order(uint16_t num)
 	/* Now new_data has what we need */
 	memcpy(&(boot_order.Data), new_data, new_data_size);
 	boot_order.DataSize = new_data_size;
+	free(new_data);
 	return create_or_edit_variable(&boot_order);
 }
 
--- a/src/include/efi.h
+++ b/src/include/efi.h
@@ -294,7 +294,9 @@ typedef struct {
 	uint8_t  signature[16];
 	uint8_t  mbr_type;
 	uint8_t  signature_type;
+#ifdef __ia64
 	uint8_t  padding[6]; /* Emperically needed */
+#endif
 } __attribute__((packed)) HARDDRIVE_DEVICE_PATH;
 
 typedef struct {
--- a/src/lib/efivars_sysfs.c
+++ b/src/lib/efivars_sysfs.c
@@ -55,6 +55,10 @@ sysfs_read_variable(const char *name, ef
 		return EFI_INVALID_PARAMETER;
 	}
 	close(fd);
+	/* latest apple firmware sets high bit which appears invalid
+	   to the linux kernel if we write it back so lets zero it out
+	   if it is set since it would be invalid to set it anyway */
+	var->Attributes = var->Attributes & ~(1 << 31);
 	return var->Status;
 }
 
--- a/src/man/man8/efibootmgr.8
+++ b/src/man/man8/efibootmgr.8
@@ -3,7 +3,7 @@
 .\" <http://shell.ipoline.com/~elmert/comp/docbook2X/> 
 .\" Please send any bug reports, improvements, comments, patches, 
 .\" etc. to Steve Cheng <steve@ggi-project.org>.
-.TH "EFIBOOTMGR" "8" "11 August 2005" "" ""
+.TH "EFIBOOTMGR" "8" "11 January 2012" "" ""
 
 .SH NAME
 efibootmgr \- manipulate the EFI Boot Manager
@@ -127,6 +127,9 @@ the data, so you can pass any binary or
 1. 
 .SS "DISPLAYING THE CURRENT SETTINGS (MUST BE ROOT)."
 .PP
+.PP
+.nf
+.B
 [root@localhost ~]# efibootmgr
 BootCurrent: 0004
 BootNext: 0003
@@ -137,6 +140,7 @@ Boot0001* CD-ROM Drive(device:FF)
 Boot0002* Hard Drive(Device:80)/HD(Part1,Sig00112233)   
 Boot0003* PXE Boot: MAC(00D0B7C15D91)               
 Boot0004* Linux
+.fi
 .PP
 This shows:
 .RS
@@ -217,8 +221,8 @@ You create the boot entry with:
 \fBefibootmgr -c -i eth0 -H 222F -U 500 -L netboot\fR
 .SH "BUGS"
 .PP
-Please direct any bugs, features, patches, etc. to Matt Domsch
-<Matt_Domsch@dell.com>\&.
+Please direct any bugs, features, patches, etc. to Jordan Hargrave
+<jordan_hargrave@dell.com>\&.
 .SH "AUTHOR"
 .PP
 This man page was generated by dann frazier <dannf@debian.org> for the 
--- a/Makefile
+++ b/Makefile
@@ -4,7 +4,7 @@
   RELEASE_MAJOR := 0
   RELEASE_MINOR := 5
   RELEASE_SUBLEVEL := 4
-  RELEASE_EXTRALEVEL :=
+  RELEASE_EXTRALEVEL := .suse2
   RELEASE_NAME := efibootmgr
   RELEASE_STRING := $(RELEASE_NAME)-$(RELEASE_MAJOR).$(RELEASE_MINOR).$(RELEASE_SUBLEVEL)$(RELEASE_EXTRALEVEL)
 
--- a/src/lib/disk.c
+++ b/src/lib/disk.c
@@ -471,6 +471,7 @@ disk_get_partition_info (int fd,
 	int rc=0;
 	int sector_size = get_sector_size(fd);
 
+
 	mbr_size = lcm(sizeof(*mbr), sector_size);
 	if ((rc = posix_memalign(&mbr_sector, sector_size, mbr_size)) != 0)
 		goto error;
--- a/src/lib/gpt.c
+++ b/src/lib/gpt.c
@@ -215,8 +215,8 @@ read_lastoddsector(int fd, uint64_t lba,
 static ssize_t
 read_lba(int fd, uint64_t lba, void *buffer, size_t bytes)
 {
-	int sector_size = get_sector_size(fd);
-	off_t offset = lba * sector_size;
+        int sector_size = get_sector_size(fd);
+        off_t offset = lba * sector_size;
         ssize_t bytesread;
         void *iobuf;
         size_t iobuf_size;
@@ -229,7 +229,7 @@ read_lba(int fd, uint64_t lba, void *buf
         memset(iobuf, 0, bytes);
 
 
-	lseek(fd, offset, SEEK_SET);
+        lseek(fd, offset, SEEK_SET);
         bytesread = read(fd, iobuf, iobuf_size);
         memcpy(buffer, iobuf, bytes);
         free(iobuf);
openSUSE Build Service is sponsored by