Skip to content

Commit a360f66

Browse files
committed
Address comments by Philippe
1 parent 51713bd commit a360f66

File tree

3 files changed

+26
-31
lines changed

3 files changed

+26
-31
lines changed

gui/guibuilder/src/TGuiBldDragManager.cxx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3265,8 +3265,9 @@ void TGuiBldDragManager::CloneEditable()
32653265
}
32663266

32673267
TString tmpfile = gSystem->TempDirectory();
3268-
TString temp = TString::Format("tmp%d.C", gRandom->Integer(100));
3269-
const char *s = gSystem->PrependPathName(tmpfile.Data(), temp);
3268+
TString temp;
3269+
temp.Form("tmp%d.C", gRandom->Integer(100));
3270+
const char *s = gSystem->PrependPathName(tmpfile, temp);
32703271
Save(s);
32713272
gROOT->Macro(s);
32723273
gSystem->Unlink(s);

net/auth/src/TAuthenticate.cxx

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3112,42 +3112,41 @@ Int_t TAuthenticate::SendRSAPublicKey(TSocket *socket, Int_t key)
31123112
Int_t TAuthenticate::ReadRootAuthrc()
31133113
{
31143114
// rootauthrc family
3115-
const char *authrc;
3116-
TString temp_rootauthrc = ".rootauthrc";
3117-
TString temp_system = "system.rootauthrc";
3115+
TString tRootAuthrc;
31183116
if (gSystem->Getenv("ROOTAUTHRC") != 0) {
3119-
authrc = gSystem->Getenv("ROOTAUTHRC");
3117+
tRootAuthrc = gSystem->Getenv("ROOTAUTHRC");
31203118
} else {
3121-
if (fgReadHomeAuthrc)
3122-
authrc = gSystem->PrependPathName(gSystem->HomeDirectory(), temp_rootauthrc);
3119+
if (fgReadHomeAuthrc) {
3120+
tRootAuthrc = ".rootauthrc";
3121+
gSystem->PrependPathName(gSystem->HomeDirectory(), tRootAuthrc);
3122+
}
31233123
}
3124-
if (authrc && gDebug > 2)
3125-
::Info("TAuthenticate::ReadRootAuthrc", "Checking file: %s", authrc);
3126-
if (!authrc || gSystem->AccessPathName(authrc, kReadPermission)) {
3127-
if (authrc && gDebug > 1)
3124+
if (!tRootAuthrc.IsNull() && gDebug > 2)
3125+
::Info("TAuthenticate::ReadRootAuthrc", "Checking file: %s", tRootAuthrc.Data());
3126+
if (tRootAuthrc.IsNull() || gSystem->AccessPathName(tRootAuthrc, kReadPermission)) {
3127+
if (!tRootAuthrc.IsNull() && gDebug > 1)
31283128
::Info("TAuthenticate::ReadRootAuthrc",
3129-
"file %s cannot be read (errno: %d)", authrc, errno);
3130-
authrc = gSystem->PrependPathName(TROOT::GetEtcDir(), temp_system);
3129+
"file %s cannot be read (errno: %d)", tRootAuthrc.Data(), errno);
3130+
tRootAuthrc = "system.rootauthrc";
3131+
gSystem->PrependPathName(TROOT::GetEtcDir(), tRootAuthrc);
31313132
if (gDebug > 2)
3132-
::Info("TAuthenticate::ReadRootAuthrc", "Checking system file: %s", authrc);
3133-
if (gSystem->AccessPathName(authrc, kReadPermission)) {
3133+
::Info("TAuthenticate::ReadRootAuthrc", "Checking system file: %s", tRootAuthrc.Data());
3134+
if (gSystem->AccessPathName(tRootAuthrc, kReadPermission)) {
31343135
if (gDebug > 1)
31353136
::Info("TAuthenticate::ReadRootAuthrc",
3136-
"file %s cannot be read (errno: %d)", authrc, errno);
3137+
"file %s cannot be read (errno: %d)", tRootAuthrc.Data(), errno);
31373138
return 0;
31383139
}
31393140
}
31403141

31413142
// Check if file has changed since last read
3142-
TString tRootAuthrc = authrc;
31433143
if (tRootAuthrc == fgRootAuthrc) {
31443144
struct stat si;
31453145
stat(tRootAuthrc, &si);
31463146
if ((UInt_t)si.st_mtime < fgLastAuthrc.Convert()) {
31473147
if (gDebug > 1)
31483148
::Info("TAuthenticate::ReadRootAuthrc",
3149-
"file %s already read", authrc);
3150-
delete [] authrc;
3149+
"file %s already read", tRootAuthrc.Data());
31513150
return 0;
31523151
}
31533152
}
@@ -3172,17 +3171,16 @@ Int_t TAuthenticate::ReadRootAuthrc()
31723171
FILE *fd = 0;
31733172
// If the temporary file is open, copy everything to the new file ...
31743173
if (expand == 1) {
3175-
TAuthenticate::FileExpand(authrc, ftmp);
3174+
TAuthenticate::FileExpand(tRootAuthrc, ftmp);
31763175
fd = ftmp;
31773176
rewind(fd);
31783177
} else {
31793178
// Open file
3180-
fd = fopen(authrc, "r");
3179+
fd = fopen(tRootAuthrc, "r");
31813180
if (fd == 0) {
31823181
if (gDebug > 2)
31833182
::Info("TAuthenticate::ReadRootAuthrc",
3184-
"file %s cannot be open (errno: %d)", authrc, errno);
3185-
delete [] authrc;
3183+
"file %s cannot be open (errno: %d)", tRootAuthrc.Data(), errno);
31863184
return 0;
31873185
}
31883186
}
@@ -3313,8 +3311,6 @@ Int_t TAuthenticate::ReadRootAuthrc()
33133311
fclose(fd);
33143312
if (expand == 1)
33153313
gSystem->Unlink(filetmp);
3316-
// Cleanup allocated memory
3317-
delete [] authrc;
33183314

33193315
// Update authinfo with new info found
33203316
TAuthenticate::MergeHostAuthList(authinfo,&tmpAuthInfo);

tree/tree/test/TChainParsing.cxx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,9 @@ void EXPECT_VEC_EQ(const std::vector<std::string> &v1, const std::vector<std::st
2222

2323
std::string ConcatUnixFileName(const char *dir, const char *name)
2424
{
25-
TString tempName(name);
26-
const char* fullPath = gSystem->PrependPathName(dir, tempName);
27-
std::unique_ptr<char[]> fileName{new char[strlen(fullPath) + 1]};
28-
strcpy(fileName.get(), fullPath);
29-
return gSystem->UnixPathName(fileName.get());
25+
TString fileName{name};
26+
gSystem->PrependPathName(dir, fileName);
27+
return gSystem->UnixPathName(fileName);
3028
}
3129

3230
TEST(TChainParsing, RemoteAdd)

0 commit comments

Comments
 (0)