]> code.delx.au - refind/commitdiff
Fixed bug that caused also_scan_dirs to ignore volume specifier.
authorsrs5694 <srs5694@users.sourceforge.net>
Sat, 6 Jul 2013 02:11:24 +0000 (22:11 -0400)
committersrs5694 <srs5694@users.sourceforge.net>
Sat, 6 Jul 2013 02:11:24 +0000 (22:11 -0400)
NEWS.txt
filesystems/fsw_efi.c
refind/main.c

index bdc1a331af9d08eea4e269927d918120da7a0006..519c53ced8b57fe3e05ff3f94ae14d9950efba6f 100644 (file)
--- a/NEWS.txt
+++ b/NEWS.txt
@@ -7,6 +7,9 @@
   (bkpbootmgfw.efi). If found, give separate entries for it and for
   bootmgfw.efi, each with its own descriptive text label.
 
+- Fixed also_scan_dirs; used to have bug that caused it to ignore
+  volume specification, if present.
+
 0.7.0 (6/27/2013):
 ------------------
 
index 6acfcbcfc4470f785830bc73b4bc7572b7a9787f..bed6a804e14221c8aa91d50634e5aa0b8a47aa25 100644 (file)
@@ -354,7 +354,8 @@ EFI_STATUS EFIAPI fsw_efi_DriverBinding_Start(IN EFI_DRIVER_BINDING_PROTOCOL  *T
                               ControllerHandle,
                               EFI_OPEN_PROTOCOL_BY_DRIVER);
     if (EFI_ERROR(Status)) {
-        return Status;
+       Print(L"Fsw ERROR: OpenProtocol(DiskIo) returned %r\n", Status);
+       return Status;
     }
 
     // allocate volume structure
index 47588eebea30a8db67d62da4e17039356c5b6cbb..af51b5999b6c1e1e380a84672943327249c5d952 100644 (file)
@@ -1039,7 +1039,7 @@ static VOID CleanUpLoaderList(struct LOADER_LIST *LoaderList) {
 // Returns TRUE if none of these conditions is met -- that is, if the path is
 // eligible for scanning.
 static BOOLEAN ShouldScan(REFIT_VOLUME *Volume, CHAR16 *Path) {
-   CHAR16   *VolName = NULL, *DontScanDir;
+   CHAR16   *VolName = NULL, *DontScanDir, *PathCopy = NULL;
    UINTN    i = 0, VolNum;
    BOOLEAN  ScanIt = TRUE;
 
@@ -1049,6 +1049,25 @@ static BOOLEAN ShouldScan(REFIT_VOLUME *Volume, CHAR16 *Path) {
    if ((StriCmp(Path, SelfDirPath) == 0) && (Volume->DeviceHandle == SelfVolume->DeviceHandle))
       return FALSE;
 
+   // See if Path includes an explicit volume declaration that's NOT Volume....
+   PathCopy = StrDuplicate(Path);
+   if (SplitVolumeAndFilename(&PathCopy, &VolName)) {
+      if (StriCmp(VolName, Volume->VolName) != 0) {
+         if ((StrLen(VolName) > 2) && (VolName[0] == L'f') && (VolName[1] == L's') && (VolName[2] >= L'0') && (VolName[2] <= L'9')) {
+            VolNum = Atoi(VolName + 2);
+            if (VolNum != Volume->VolNumber) {
+               ScanIt = FALSE;
+            }
+         } else {
+            ScanIt = FALSE;
+         }
+      } // if
+   } // if Path includes volume specification
+   MyFreePool(PathCopy);
+   MyFreePool(VolName);
+   VolName = NULL;
+
+   // See if Volume is in GlobalConfig.DontScanDirs....
    while ((DontScanDir = FindCommaDelimited(GlobalConfig.DontScanDirs, i++)) && ScanIt) {
       SplitVolumeAndFilename(&DontScanDir, &VolName);
       CleanUpPathNameSlashes(DontScanDir);
@@ -1065,8 +1084,10 @@ static BOOLEAN ShouldScan(REFIT_VOLUME *Volume, CHAR16 *Path) {
             ScanIt = FALSE;
       }
       MyFreePool(DontScanDir);
+      MyFreePool(VolName);
       DontScanDir = NULL;
-   }
+   } // while()
+
    return ScanIt;
 } // BOOLEAN ShouldScan()
 
@@ -1339,11 +1360,13 @@ static VOID ScanEfiFiles(REFIT_VOLUME *Volume) {
       // Scan user-specified (or additional default) directories....
       i = 0;
       while ((Directory = FindCommaDelimited(GlobalConfig.AlsoScan, i++)) != NULL) {
-         SplitVolumeAndFilename(&Directory, &VolName);
-         CleanUpPathNameSlashes(Directory);
-         Length = StrLen(Directory);
-         if ((Length > 0) && ScanLoaderDir(Volume, Directory, MatchPatterns))
-            ScanFallbackLoader = FALSE;
+         if (ShouldScan(Volume, Directory)) {
+            SplitVolumeAndFilename(&Directory, &VolName);
+            CleanUpPathNameSlashes(Directory);
+            Length = StrLen(Directory);
+            if ((Length > 0) && ScanLoaderDir(Volume, Directory, MatchPatterns))
+               ScanFallbackLoader = FALSE;
+         } // if
          MyFreePool(Directory);
          MyFreePool(VolName);
       } // while