Skip to content

Commit 04b5894

Browse files
committed
io: Avoid infinite recursion in TFile::Open
This fixes root-project#15590
1 parent 321895c commit 04b5894

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

io/io/src/TFile.cxx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4115,16 +4115,17 @@ TFile *TFile::Open(const char *url, Option_t *options, const char *ftitle,
41154115
f = (TFile*) h->ExecPlugin(4, name.Data(), option, ftitle, compress);
41164116
} else {
41174117
// Just try to open it locally but via TFile::Open, so that we pick-up the correct
4118-
// plug-in in the case file name contains information about a special backend (e.g.
4119-
f = TFile::Open(urlname.GetFileAndOptions(), option, ftitle, compress);
4118+
// plug-in in the case file name contains information about a special backend (e.g.)
4119+
if (strcmp(name, urlname.GetFileAndOptions()) != 0)
4120+
f = TFile::Open(urlname.GetFileAndOptions(), option, ftitle, compress);
41204121
}
41214122
}
41224123
}
41234124

41244125
if (f && f->IsZombie()) {
41254126
TString newUrl = f->GetNewUrl();
41264127
delete f;
4127-
if( newUrl.Length() && gEnv->GetValue("TFile.CrossProtocolRedirects", 1) )
4128+
if( newUrl.Length() && (newUrl != name) && gEnv->GetValue("TFile.CrossProtocolRedirects", 1) )
41284129
f = TFile::Open( newUrl, option, ftitle, compress );
41294130
else
41304131
f = nullptr;

0 commit comments

Comments
 (0)