Skip to content

Commit

Permalink
io: Avoid infinite recursion in TFile::Open
Browse files Browse the repository at this point in the history
  • Loading branch information
pcanal committed May 21, 2024
1 parent a2d3663 commit ddecc0d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions io/io/src/TFile.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -4285,16 +4285,17 @@ TFile *TFile::Open(const char *url, Option_t *options, const char *ftitle,
f = (TFile*) h->ExecPlugin(4, name.Data(), option, ftitle, compress);
} else {
// Just try to open it locally but via TFile::Open, so that we pick-up the correct
// plug-in in the case file name contains information about a special backend (e.g.
f = TFile::Open(urlname.GetFileAndOptions(), option, ftitle, compress);
// plug-in in the case file name contains information about a special backend (e.g.)
if (strcmp(name, urlname.GetFileAndOptions()) != 0)
f = TFile::Open(urlname.GetFileAndOptions(), option, ftitle, compress);
}
}
}

if (f && f->IsZombie()) {
TString newUrl = f->GetNewUrl();
delete f;
if( newUrl.Length() && gEnv->GetValue("TFile.CrossProtocolRedirects", 1) )
if( newUrl.Length() && (newUrl != name) && gEnv->GetValue("TFile.CrossProtocolRedirects", 1) )
f = TFile::Open( newUrl, option, ftitle, compress );
else
f = nullptr;
Expand Down

0 comments on commit ddecc0d

Please sign in to comment.