Don't choose an initrd which has no characters in common with the kernel
authorJames Bunton <jamesbunton@delx.net.au>
Mon, 13 Mar 2017 09:35:27 +0000 (20:35 +1100)
committerJames Bunton <jamesbunton@delx.net.au>
Mon, 13 Mar 2017 09:35:27 +0000 (20:35 +1100)
refind/main.c

index eeb7719..22415e8 100644 (file)
@@ -584,7 +584,7 @@ static CHAR16 * FindInitrd(IN CHAR16 *LoaderPath, IN REFIT_VOLUME *Volume) {
                 KernelPostNum = MyStrStr(LoaderPath, KernelVersion);
                 InitrdPostNum = MyStrStr(CurrentInitrdName->Value, KernelVersion);
                 SharedChars = NumCharsInCommon(KernelPostNum, InitrdPostNum);
-                if (SharedChars > MaxSharedChars) {
+                if (SharedChars > MaxSharedChars && SharedChars > 0) {
                     MaxSharedChars = SharedChars;
                     MaxSharedInitrd = CurrentInitrdName;
                 } // if