File efivar-boo961664-fix-return-value.patch of Package efivar.4523
commit 3a820e05eeac0b069f46582cb34f364000feb996
Author: Peter Jones <pjones@redhat.com>
Date: Mon Jul 13 13:14:58 2015 -0400
Fix return value checking in efi_guid_to_name and efi_guid_to_symbol.
I really have no idea how that was supposed to work.
This needs a better test suite.
Signed-off-by: Peter Jones <pjones@redhat.com>
diff --git a/src/guid.c b/src/guid.c
index 345443f..35d9d1a 100644
--- a/src/guid.c
+++ b/src/guid.c
@@ -117,7 +117,7 @@ efi_guid_to_name(efi_guid_t *guid, char **name)
{
struct guidname *result;
int rc = _get_common_guidname(guid, &result);
- if (rc < 0) {
+ if (rc >= 0) {
*name = strndup(result->name, sizeof (result->name) -1);
return *name ? (int)strlen(*name) : -1;
}
@@ -131,7 +131,7 @@ efi_guid_to_symbol(efi_guid_t *guid, char **symbol)
{
struct guidname *result;
int rc = _get_common_guidname(guid, &result);
- if (rc < 0) {
+ if (rc >= 0) {
*symbol = strndup(result->symbol, sizeof (result->symbol) -1);
return *symbol ? (int)strlen(*symbol) : -1;
}