OSDN Git Service

libefivar/libs.c:probe(): Fix the case where the first probe fails.
authorPeter Jones <pjones@redhat.com>
Mon, 22 Aug 2016 15:42:50 +0000 (11:42 -0400)
committerPeter Jones <pjones@redhat.com>
Tue, 13 Sep 2016 18:32:25 +0000 (14:32 -0400)
When adding efi_set_error() support, I accidentally changed it to treat
a probe failure as a success, which winds up meaning you always try
efivarfs even if the probe failed.

Fixes github issue https://github.com/rhinstaller/efibootmgr/issues/54
Fixes https://bugs.gentoo.org/show_bug.cgi?id=591864

Signed-off-by: Peter Jones <pjones@redhat.com>
src/lib.c

index 60709e3..03c64b0 100644 (file)
--- a/src/lib.c
+++ b/src/lib.c
@@ -256,13 +256,13 @@ libefivar_init(void)
                        }
                } else {
                        int rc = ops_list[i]->probe();
-                       if (rc <= 0)
+                       if (rc <= 0) {
                                efi_error("ops_list[%d]->probe() failed", i);
-                       else
+                       } else {
                                efi_error_clear();
-
-                       ops = ops_list[i];
-                       break;
+                               ops = ops_list[i];
+                               break;
+                       }
                }
        }
 }