diff --git a/proof/pq2/src/pq2actions.cxx b/proof/pq2/src/pq2actions.cxx index f4fb9f0f32bab2a3fa71be8a3f018a115327f57e..e4fad501cf6598be22e81ee4af4c9642ea81683e 100644 --- a/proof/pq2/src/pq2actions.cxx +++ b/proof/pq2/src/pq2actions.cxx @@ -588,7 +588,8 @@ void do_anadist(const char *ds, const char *servers, const char *ignsrvs, // Name TString cname(ds); if (cname.BeginsWith("/")) cname.Remove(0,1); - if (cname.EndsWith("/")) cname.Remove(cname.Last('/')); + Ssiz_t ilst = kNPOS; + if (cname.EndsWith("/") && (ilst = cname.Last('/')) != kNPOS) cname.Remove(ilst); cname.ReplaceAll("/", "-"); cname.ReplaceAll("*", "-star-"); distinfo.SetName(cname); @@ -1003,7 +1004,8 @@ int do_anadist_ds(TFileCollection *fc, const char *servers, const char *ignsrvs, u.SetOptions(""); TString php(u.GetUrl()); php.Remove(php.Index(u.GetFile())); - if (php.EndsWith("/")) php.Remove(php.Last('/')); + Ssiz_t ilst = kNPOS; + if (php.EndsWith("/") && ((ilst = php.Last('/')) != kNPOS)) php.Remove(ilst); if (fout) { fprintf(fout,"%s %s %s\n", u.GetFile(), php.Data(), fcd->GetName()); } else { diff --git a/proof/pq2/src/pq2main.cxx b/proof/pq2/src/pq2main.cxx index cd97cba7169ef407a69852faf15d4fae6713ae51..f3b355e7a7cd041102be0be18d506883b381ee4c 100644 --- a/proof/pq2/src/pq2main.cxx +++ b/proof/pq2/src/pq2main.cxx @@ -324,7 +324,7 @@ int main(int argc, char **argv) } catch (std::exception& exc) { Printf("Standard exception caught: we abort whatever it is ..."); - throw; + throw exc; } catch (const char *str) { Printf("Exception thrown: %s", str); diff --git a/proof/pq2/src/pq2ping.cxx b/proof/pq2/src/pq2ping.cxx index 360f5ca63159492d6d4cc68b92db0671583af341..b7b9d2c51bab6959013d414d0af75d3f2036e37e 100644 --- a/proof/pq2/src/pq2ping.cxx +++ b/proof/pq2/src/pq2ping.cxx @@ -200,16 +200,29 @@ Int_t pingXproofdAt() return -1; } // Send the first bytes + int writeCount = -1; clnt_HS_t initHS; memset(&initHS, 0, sizeof(initHS)); initHS.third = (int)host2net((int)1); int len = sizeof(initHS); - s.SendRaw(&initHS, len); + writeCount = s.SendRaw(&initHS, len); + if (writeCount != len) { + if (gDebug > 0) + Printf("pingXproofdAt: 1st: wrong number of bytes sent: %d (expected: %d)", + writeCount, len); + return 1; + } // These 8 bytes are need by 'proofd' and discarded by XPD int dum[2]; dum[0] = (int)host2net((int)4); dum[1] = (int)host2net((int)2012); - s.SendRaw(&dum[0], sizeof(dum)); + writeCount = s.SendRaw(&dum[0], sizeof(dum)); + if (writeCount != sizeof(dum)) { + if (gDebug > 0) + Printf("pingXproofdAt: 2nd: wrong number of bytes sent: %d (expected: %d)", + writeCount, (int) sizeof(dum)); + return 1; + } // Read first server response int type; len = sizeof(type); diff --git a/proof/proof/src/TDataSetManager.cxx b/proof/proof/src/TDataSetManager.cxx index 61116f4f1efe96915d131778949f9fbfeee6370e..70ba1429a3215463dfdd393a6ff8c8bef1ca48ff 100644 --- a/proof/proof/src/TDataSetManager.cxx +++ b/proof/proof/src/TDataSetManager.cxx @@ -702,7 +702,8 @@ void TDataSetManager::MonitorUsedSpace(TVirtualMonitoringWriter *monitoring) list->Add(new TParameter<Long64_t>(user->String().Data(), size2->GetVal())); } - monitoring->SendParameters(list, group->String()); + if (!monitoring->SendParameters(list, group->String())) + Warning("MonitorUsedSpace", "problems sending monitoring parameters"); delete list; } } diff --git a/proof/proof/src/TProof.cxx b/proof/proof/src/TProof.cxx index fa478343d7bd2c8ae9072d9b3b66adbe70808607..45025978936d66bdb51a64c6d0e8ff80c1325ffe 100644 --- a/proof/proof/src/TProof.cxx +++ b/proof/proof/src/TProof.cxx @@ -5629,8 +5629,8 @@ Int_t TProof::SendFile(const char *file, Int_t opt, const char *rfile, TSlave *w } // Get info about the file - Long64_t size; - Long_t id, flags, modtime; + Long64_t size = -1; + Long_t id, flags, modtime = 0; if (gSystem->GetPathInfo(file, &id, &size, &flags, &modtime) == 1) { Error("SendFile", "cannot stat file %s", file); return -1; diff --git a/proof/proof/src/TProofMgr.cxx b/proof/proof/src/TProofMgr.cxx index 48f028d19b5da0f3646912b4188cffd5a8a2bcd2..7cb0bc225d88a723b7cb963b1060f3c34395da65 100644 --- a/proof/proof/src/TProofMgr.cxx +++ b/proof/proof/src/TProofMgr.cxx @@ -649,16 +649,27 @@ Int_t TProofMgr::Ping(const char *url) return -1; } // Send the first bytes + int writeCount = -1; clnt_HS_t initHS; memset(&initHS, 0, sizeof(initHS)); initHS.third = (int)host2net((int)1); int len = sizeof(initHS); - s.SendRaw(&initHS, len); + if ((writeCount = s.SendRaw(&initHS, len)) != len) { + if (gDebug > 0) + ::Info("TProofMgr::Ping", "1st: wrong number of bytes sent: %d (expected: %d)", + writeCount, len); + return 1; + } // These 8 bytes are need by 'proofd' and discarded by XPD int dum[2]; dum[0] = (int)host2net((int)4); dum[1] = (int)host2net((int)2012); - s.SendRaw(&dum[0], sizeof(dum)); + if ((writeCount = s.SendRaw(&dum[0], sizeof(dum))) != sizeof(dum)) { + if (gDebug > 0) + ::Info("TProofMgr::Ping", "2nd: wrong number of bytes sent: %d (expected: %d)", + writeCount, (int) sizeof(dum)); + return 1; + } // Read first server response int type; len = sizeof(type); diff --git a/proof/proof/src/TProofServ.cxx b/proof/proof/src/TProofServ.cxx index 43690bc076ce6a5a238deeb8d89bbd6e8f4e590f..be0bedbaefcd325857131d14f657edbf7ff06c4e 100644 --- a/proof/proof/src/TProofServ.cxx +++ b/proof/proof/src/TProofServ.cxx @@ -1020,7 +1020,7 @@ Int_t TProofServ::CatMotd() lastname = TString(GetWorkDir()) + "/.prooflast"; char *last = gSystem->ExpandPathName(lastname.Data()); Long64_t size; - Long_t id, flags, modtime, lasttime; + Long_t id, flags, modtime, lasttime = 0; if (gSystem->GetPathInfo(last, &id, &size, &flags, &lasttime) == 1) lasttime = 0; @@ -1065,7 +1065,10 @@ TObject *TProofServ::Get(const char *namecycle) // This method is called by TDirectory::Get() in case the object can not // be found locally. - fSocket->Send(namecycle, kPROOF_GETOBJECT); + if (fSocket->Send(namecycle, kPROOF_GETOBJECT) < 0) { + Error("Get", "problems sending request"); + return (TObject *)0; + } TObject *idcur = 0; @@ -1535,7 +1538,8 @@ Int_t TProofServ::HandleSocketInput(TMessage *mess, Bool_t all) case kPROOF_STATUS: Warning("HandleSocketInput:kPROOF_STATUS", "kPROOF_STATUS message is obsolete"); - fSocket->Send(fProof->GetParallel(), kPROOF_STATUS); + if (fSocket->Send(fProof->GetParallel(), kPROOF_STATUS) < 0) + Warning("HandleSocketInput:kPROOF_STATUS", "problem sending of request"); break; case kPROOF_GETSTATS: @@ -2100,7 +2104,10 @@ Bool_t TProofServ::AcceptResults(Int_t connections, TVirtualProofPlayer *mergerP if (++numworkers >= connections) fMergingMonitor->Remove(fMergingSocket); } else { - s->Recv(mess); + if (s->Recv(mess) < 0) { + Error("AcceptResults", "problems receiving message"); + continue; + } PDB(kSubmerger, 2) Info("AcceptResults", "message received: %d ", (mess ? mess->What() : 0)); if (!mess) { @@ -2459,7 +2466,8 @@ Int_t TProofServ::ReceiveFile(const char *file, Bool_t bin, Long64_t size) close(fd); - chmod(file, 0644); + if (chmod(file, 0644) != 0) + Warning("ReceiveFile", "error setting mode 0644 on file %s", file); return 0; } @@ -3070,16 +3078,22 @@ Int_t TProofServ::SetupCommon() if (!dsms.IsNull()) { TString dsm; Int_t from = 0; - dsms.Tokenize(dsm, from, ","); - // Get plugin manager to load the appropriate TDataSetManager - if (gROOT->GetPluginManager()) { - // Find the appropriate handler - h = gROOT->GetPluginManager()->FindHandler("TDataSetManager", dsm); - if (h && h->LoadPlugin() != -1) { - // make instance of the dataset manager - fDataSetManager = - reinterpret_cast<TDataSetManager*>(h->ExecPlugin(3, fGroup.Data(), - fUser.Data(), dsm.Data())); + while (dsms.Tokenize(dsm, from, ",")) { + if (fDataSetManager && !fDataSetManager->TestBit(TObject::kInvalidObject)) { + Warning("SetupCommon", "a valid dataset manager already initialized"); + Warning("SetupCommon", "support for multiple managers not yet available"); + break; + } + // Get plugin manager to load the appropriate TDataSetManager + if (gROOT->GetPluginManager()) { + // Find the appropriate handler + h = gROOT->GetPluginManager()->FindHandler("TDataSetManager", dsm); + if (h && h->LoadPlugin() != -1) { + // make instance of the dataset manager + fDataSetManager = + reinterpret_cast<TDataSetManager*>(h->ExecPlugin(3, fGroup.Data(), + fUser.Data(), dsm.Data())); + } } } // Check the result of the dataset manager initialization @@ -4816,7 +4830,10 @@ void TProofServ::HandleCheckFile(TMessage *mess, TString *slb) Info("HandleCheckFile", "package %s already on node", filenam.Data()); if (IsMaster()) - fProof->UploadPackage(fPackageDir + "/" + filenam); + if (fProof->UploadPackage(fPackageDir + "/" + filenam) != 0) + Info("HandleCheckFile", + "problems with uploading package %s", filenam.Data()); + } else { reply << (Int_t)0; if (fProtocol <= 19) reply.Reset(kPROOF_FATAL); @@ -4843,7 +4860,9 @@ void TProofServ::HandleCheckFile(TMessage *mess, TString *slb) Info("HandleCheckFile", "package %s already on node", filenam.Data()); if (IsMaster()) - fProof->UploadPackage(fPackageDir + "/" + filenam); + if (fProof->UploadPackage(fPackageDir + "/" + filenam) != 0) + Info("HandleCheckFile", + "problems with uploading package %s", filenam.Data()); } else { reply << (Int_t)0; if (fProtocol <= 19) reply.Reset(kPROOF_FATAL); diff --git a/proof/proof/src/TProofServLite.cxx b/proof/proof/src/TProofServLite.cxx index 1223f4965afb1c5102fa69837ddd9d0523241a08..c71395f9db4e811f0f05422ce3d73cf5f927b9c1 100644 --- a/proof/proof/src/TProofServLite.cxx +++ b/proof/proof/src/TProofServLite.cxx @@ -526,11 +526,12 @@ Int_t TProofServLite::SetupOnFork(const char *ord) while ((e = gSystem->GetDirEntry(dirp))) { ent.Form("%s/%s", sdir.Data(), e); FileStat_t st; - gSystem->GetPathInfo(ent.Data(), st); - if (st.fIsLink && ent.Contains(sord)) { - PDB(kGlobal, 1) - Info("SetupOnFork","unlinking: %s", ent.Data()); - gSystem->Unlink(ent); + if (gSystem->GetPathInfo(ent.Data(), st) == 0) { + if (st.fIsLink && ent.Contains(sord)) { + PDB(kGlobal, 1) + Info("SetupOnFork","unlinking: %s", ent.Data()); + gSystem->Unlink(ent); + } } } gSystem->FreeDirectory(dirp); diff --git a/proof/proofplayer/src/TProofDraw.cxx b/proof/proofplayer/src/TProofDraw.cxx index 8657424b3c95ae96243792951bbeebda5d8847e0..f75b932d5a51632699beb2200eec07b2509e1408 100644 --- a/proof/proofplayer/src/TProofDraw.cxx +++ b/proof/proofplayer/src/TProofDraw.cxx @@ -1636,7 +1636,7 @@ void TProofDrawGraph::Terminate(void) } if (!hist->TestBit(kCanDelete)) { for (int i = 0; i < fGraph->GetN(); i++) { - Double_t x, y; + Double_t x = 0, y = 0; fGraph->GetPoint(i, x, y); hist->Fill(x, y, 1); } @@ -1780,7 +1780,7 @@ void TProofDrawPolyMarker3D::Terminate(void) fPolyMarker3D->GetPoint(0, rmax[0], rmax[1], rmax[2]); } for (int i = 1; i < fPolyMarker3D->Size(); i++) { - Double_t v[3]; + Double_t v[3] = {0}; fPolyMarker3D->GetPoint(i, v[0], v[1], v[2]); for (int ii = 0; ii < 3; ii++) { if (v[ii] < rmin[ii]) rmin[ii] = v[ii]; @@ -1827,7 +1827,7 @@ void TProofDrawPolyMarker3D::Terminate(void) gPad->Update(); if (!hist->TestBit(kCanDelete)) { for (int i = 0; i < fPolyMarker3D->Size(); i++) { - Float_t x, y, z; + Double_t x = 0, y = 0, z = 0; fPolyMarker3D->GetPoint(i, x, y, z); hist->Fill(x, y, z, 1); } diff --git a/proof/proofplayer/src/TVirtualPacketizer.cxx b/proof/proofplayer/src/TVirtualPacketizer.cxx index 9e114073d349953dc16669dfb7b1261448ed4f6e..d8d5a590a37df86bd245d685794ba60a9cce985b 100644 --- a/proof/proofplayer/src/TVirtualPacketizer.cxx +++ b/proof/proofplayer/src/TVirtualPacketizer.cxx @@ -150,8 +150,8 @@ TVirtualPacketizer::TVirtualPacketizer(TList *input, TProofProgressStatus *st) // Whether to send estimated values for the progress info TString estopt; - TProof::GetParameter(input, "PROOF_RateEstimation", estopt); - if (estopt.IsNull()) { + if (TProof::GetParameter(input, "PROOF_RateEstimation", estopt) != 0 || + estopt.IsNull()) { // Parse option from the env estopt = gEnv->GetValue("Proof.RateEstimation", ""); }