Skip to content

Commit

Permalink
First stage of fixes for gcc 7 as per davidlt suggestions.
Browse files Browse the repository at this point in the history
  • Loading branch information
abh3 committed Jan 16, 2017
1 parent 3f87e97 commit 1e2f169
Show file tree
Hide file tree
Showing 20 changed files with 73 additions and 28 deletions.
2 changes: 2 additions & 0 deletions src/XrdApps/XrdMpxStats.cc
Expand Up @@ -473,6 +473,7 @@ int main(int argc, char *argv[])
else {Say.Emsg(":", "Invalid format - ", optarg); Usage(1);}
break;
case 'h': Usage(0);
break;
case 'p': if (!(Port = atoi(optarg)))
{Say.Emsg(":", "Invalid port number - ", optarg); Usage(1);}
break;
Expand All @@ -482,6 +483,7 @@ int main(int argc, char *argv[])
if (c == ':') Say.Emsg(":", buff, "value not specified.");
else Say.Emsg(0, buff, "option is invalid");
Usage(1);
break;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/XrdCms/XrdCmsManTree.cc
Expand Up @@ -79,7 +79,7 @@ int XrdCmsManTree::Connect(int nID, XrdCmsNode *nP)
{
static CmsDiscRequest discRequest = {{0, kYR_disc, 0, 0}};
XrdSysMutexHelper Monitor(myMutex);
char mybuff[8];
char mybuff[16];
int i;

// Rule 0: If we aborted tell the client to just stop doing this
Expand Down
2 changes: 1 addition & 1 deletion src/XrdCms/XrdCmsManTree.hh
Expand Up @@ -80,7 +80,7 @@ struct TreeInfo

} tmInfo[XrdCmsManager::MTMax];

char buff[8];
char buff[16];
int maxTMI;
int numConn;
int maxConn;
Expand Down
11 changes: 11 additions & 0 deletions src/XrdCms/XrdCmsReq.cc
Expand Up @@ -135,16 +135,27 @@ void XrdCmsReq::Reply_Error(int ecode, const char *emsg, int elen)
//
switch(ecode)
{case ENOENT: eval = kYR_ENOENT;
break;
case EPERM: eval = kYR_EPERM;
break;
case EACCES: eval = kYR_EACCES;
break;
case EIO: eval = kYR_EIO;
break;
case ENOMEM: eval = kYR_ENOMEM;
break;
case ENOSPC: eval = kYR_ENOSPC;
break;
case ENAMETOOLONG: eval = kYR_ENAMETOOLONG;
break;
case ENETUNREACH: eval = kYR_ENETUNREACH;
break;
case ENOTBLK: eval = kYR_ENOTBLK;
break;
case EISDIR: eval = kYR_EISDIR;
break;
default: eval = kYR_EINVAL;
break;
};

// Make sure that elen includes a null byte
Expand Down
2 changes: 2 additions & 0 deletions src/XrdCns/XrdCnsConfig.cc
Expand Up @@ -150,6 +150,8 @@ int XrdCnsConfig::Configure(int argc, char **argv, char *argt)
else NoGo = NAPath("'-a'", Spec.argval);
break;
case 'B': Opts |= optNoCns;
bPath = Spec.argval;
break;
case 'b': bPath = Spec.argval;
break;
case 'c': cPath = Spec.argval;
Expand Down
22 changes: 12 additions & 10 deletions src/XrdCrypto/XrdCryptosslX509.cc
Expand Up @@ -507,8 +507,9 @@ const char *XrdCryptosslX509::IssuerHash(int alg)
if (issueroldhash.length() <= 0) {
// Make sure we have a certificate
if (cert) {
char chash[15] = {0};
snprintf(chash,15,"%08lx.0",X509_NAME_hash_old(cert->cert_info->issuer));
char chash[30] = {0};
snprintf(chash, sizeof(chash),
"%08lx.0",X509_NAME_hash_old(cert->cert_info->issuer));
issueroldhash = chash;
} else {
DEBUG("WARNING: no certificate available - cannot extract issuer hash (md5)");
Expand All @@ -526,9 +527,9 @@ const char *XrdCryptosslX509::IssuerHash(int alg)

// Make sure we have a certificate
if (cert) {
char chash[15] = {0};
if (chash[0] == 0)
snprintf(chash,15,"%08lx.0",X509_NAME_hash(cert->cert_info->issuer));
char chash[30] = {0};
snprintf(chash, sizeof(chash),
"%08lx.0",X509_NAME_hash(cert->cert_info->issuer));
issuerhash = chash;
} else {
DEBUG("WARNING: no certificate available - cannot extract issuer hash (default)");
Expand All @@ -553,8 +554,9 @@ const char *XrdCryptosslX509::SubjectHash(int alg)
if (subjectoldhash.length() <= 0) {
// Make sure we have a certificate
if (cert) {
char chash[15] = {0};
snprintf(chash,15,"%08lx.0",X509_NAME_hash_old(cert->cert_info->subject));
char chash[30] = {0};
snprintf(chash, sizeof(chash),
"%08lx.0",X509_NAME_hash_old(cert->cert_info->subject));
subjectoldhash = chash;
} else {
DEBUG("WARNING: no certificate available - cannot extract subject hash (md5)");
Expand All @@ -572,9 +574,9 @@ const char *XrdCryptosslX509::SubjectHash(int alg)

// Make sure we have a certificate
if (cert) {
char chash[15] = {0};
if (chash[0] == 0)
snprintf(chash,15,"%08lx.0",X509_NAME_hash(cert->cert_info->subject));
char chash[30] = {0};
snprintf(chash, sizeof(chash),
"%08lx.0",X509_NAME_hash(cert->cert_info->subject));
subjecthash = chash;
} else {
DEBUG("WARNING: no certificate available - cannot extract subject hash (default)");
Expand Down
11 changes: 6 additions & 5 deletions src/XrdCrypto/XrdCryptosslX509Crl.cc
Expand Up @@ -482,8 +482,9 @@ const char *XrdCryptosslX509Crl::IssuerHash(int alg)
if (issueroldhash.length() <= 0) {
// Make sure we have a certificate
if (crl) {
char chash[15] = {0};
snprintf(chash,15,"%08lx.0",X509_NAME_hash_old(crl->crl->issuer));
char chash[30] = {0};
snprintf(chash, sizeof(chash),
"%08lx.0",X509_NAME_hash_old(crl->crl->issuer));
issueroldhash = chash;
} else {
DEBUG("WARNING: no certificate available - cannot extract issuer hash (md5)");
Expand All @@ -501,9 +502,9 @@ const char *XrdCryptosslX509Crl::IssuerHash(int alg)

// Make sure we have a certificate
if (crl) {
char chash[15] = {0};
if (chash[0] == 0)
snprintf(chash,15,"%08lx.0",X509_NAME_hash(crl->crl->issuer));
char chash[30] = {0};
snprintf(chash, sizeof(chash),
"%08lx.0",X509_NAME_hash(crl->crl->issuer));
issuerhash = chash;
} else {
DEBUG("WARNING: no certificate available - cannot extract issuer hash (default)");
Expand Down
11 changes: 6 additions & 5 deletions src/XrdCrypto/XrdCryptosslX509Req.cc
Expand Up @@ -188,8 +188,9 @@ const char *XrdCryptosslX509Req::SubjectHash(int alg)
if (subjectoldhash.length() <= 0) {
// Make sure we have a certificate
if (creq) {
char chash[15] = {0};
snprintf(chash,15,"%08lx.0",X509_NAME_hash_old(creq->req_info->subject));
char chash[30] = {0};
snprintf(chash, sizeof(chash),
"%08lx.0",X509_NAME_hash_old(creq->req_info->subject));
subjectoldhash = chash;
} else {
DEBUG("WARNING: no certificate available - cannot extract subject hash (md5)");
Expand All @@ -207,9 +208,9 @@ const char *XrdCryptosslX509Req::SubjectHash(int alg)

// Make sure we have a certificate
if (creq) {
char chash[15] = {0};
if (chash[0] == 0)
snprintf(chash,15,"%08lx.0",X509_NAME_hash(creq->req_info->subject));
char chash[30] = {0};
snprintf(chash, sizeof(chash),
"%08lx.0",X509_NAME_hash(creq->req_info->subject));
subjecthash = chash;
} else {
DEBUG("WARNING: no certificate available - cannot extract subject hash (default)");
Expand Down
9 changes: 9 additions & 0 deletions src/XrdFrc/XrdFrcReqFile.cc
Expand Up @@ -362,6 +362,9 @@ void XrdFrcReqFile::ListL(XrdFrcRequest &tmpReq, char *Buff, int bsz,
switch(ITList[i])
{case XrdFrcRequest::getOBJ:
Lfo = 0;
n = strlen(tmpReq.LFN);
strlcpy(Buff, tmpReq.LFN, bln);
break;

case XrdFrcRequest::getLFN:
n = strlen(tmpReq.LFN+Lfo);
Expand All @@ -370,6 +373,12 @@ void XrdFrcReqFile::ListL(XrdFrcRequest &tmpReq, char *Buff, int bsz,

case XrdFrcRequest::getOBJCGI:
Lfo = 0;
n = strlen(tmpReq.LFN); tmpReq.LFN[n] = '?';
if (!tmpReq.Opaque) tmpReq.LFN[n+1] = '\0';
strlcpy(Buff, tmpReq.LFN, bln);
k = strlen(tmpReq.LFN);
tmpReq.LFN[n] = '\0'; n = k;
break;

case XrdFrcRequest::getLFNCGI:
n = strlen(tmpReq.LFN); tmpReq.LFN[n] = '?';
Expand Down
2 changes: 2 additions & 0 deletions src/XrdFrc/XrdFrcUtils.cc
Expand Up @@ -193,9 +193,11 @@ int XrdFrcUtils::MapR2Q(char Opc, int *Flags)
{case 0 :
case '+': return XrdFrcRequest::stgQ;
case '^': if (Flags) *Flags = XrdFrcRequest::Purge;
return XrdFrcRequest::migQ;
case '&': return XrdFrcRequest::migQ;
case '<': return XrdFrcRequest::getQ;
case '=': if (Flags) *Flags |= XrdFrcRequest::Purge;
return XrdFrcRequest::putQ;
case '>': return XrdFrcRequest::putQ;
default: break;
}
Expand Down
1 change: 1 addition & 0 deletions src/XrdFrm/XrdFrmConfig.cc
Expand Up @@ -267,6 +267,7 @@ int XrdFrmConfig::Configure(int argc, char **argv, int (*ppf)())
case 'f': Fix = 1;
break;
case 'h': Usage(0);
break;
case 'k': if (!(bindArg = Say.logger()->ParseKeep(optarg)))
{Say.Emsg("Config","Invalid -k argument -",optarg);
Usage(1);
Expand Down
2 changes: 1 addition & 1 deletion src/XrdFrm/XrdFrmTransfer.cc
Expand Up @@ -503,7 +503,7 @@ void XrdFrmTransfer::Start()
xfrP->PFN[xfrP->pfnEnd] = 0;

if (xfrP->RetCode || Config.Verbose)
{char buff1[80], buff2[80];
{char buff1[280], buff2[80];
sprintf(buff1, "%s for %s", xfrP->RetCode ? "failed" : "complete",
xfrP->reqData.User);
if (xfrP->RetCode == 0) *buff2 = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/XrdHttp/XrdHttpProtocol.cc
Expand Up @@ -1081,7 +1081,7 @@ int XrdHttpProtocol::SendData(char *body, int bodylen) {

int XrdHttpProtocol::SendSimpleResp(int code, char *desc, char *header_to_add, char *body, long long bodylen) {
char outhdr[512];
char b[16];
char b[32];
long long l;
const char *crlf = "\r\n";
outhdr[0] = '\0';
Expand Down
2 changes: 1 addition & 1 deletion src/XrdOfs/XrdOfsTPCProg.hh
Expand Up @@ -64,7 +64,7 @@ static XrdOfsTPCProg *pgmIdle;
XrdOucStream JobStream;
XrdOfsTPCProg *Next;
XrdOfsTPCJob *Job;
char Pname[16];
char Pname[32];
char eRec[1024];
};
#endif
2 changes: 2 additions & 0 deletions src/XrdOuc/XrdOucMsubs.cc
Expand Up @@ -240,6 +240,8 @@ char *XrdOucMsubs::getVal(XrdOucMsubsInfo &Info, int vNum)
break;

case vRID: if (Info.Rid) return (char *)Info.Rid;
return (char *)Info.Tid;

case vTID: return (char *)Info.Tid;

case vCGI: if (!(op = Info.Env->Env(n))) op = (char *)"";
Expand Down
4 changes: 4 additions & 0 deletions src/XrdOuc/XrdOucPup.cc
Expand Up @@ -209,6 +209,8 @@ int XrdOucPup::Pack(struct iovec *iovP, struct iovec *iovE, XrdOucPupArgs *pup,
case PT_Mark:
*Base.B08 = (char *)vP;
if (pP->Dtype == PT_Mark) break;
vP++;
break;

case PT_Skip:
vP++;
Expand All @@ -224,6 +226,8 @@ int XrdOucPup::Pack(struct iovec *iovP, struct iovec *iovE, XrdOucPupArgs *pup,

case PT_EndFill:
*Base.B16 = htons(static_cast<unsigned short>(TotLen));
return static_cast<int>(vP-iovP);

case PT_End:
return static_cast<int>(vP-iovP);

Expand Down
1 change: 1 addition & 0 deletions src/XrdSecsss/XrdSecProtocolsss.cc
Expand Up @@ -393,6 +393,7 @@ char *XrdSecProtocolsss::Load_Client(XrdOucErrInfo *erp, const char *parms)
switch(aType)
{case XrdSecsssID::idDynamic: isMutual = 1; break;
case XrdSecsssID::idStaticM: isMutual = 1;
idMap = 0; break;
case XrdSecsssID::idStatic:
default: idMap = 0; break;
}
Expand Down
7 changes: 5 additions & 2 deletions src/XrdSut/XrdSutPFile.cc
Expand Up @@ -375,8 +375,11 @@ kXR_int32 XrdSutPFile::Open(kXR_int32 opt, bool *wasopen,
switch (opt) {
case 2:
//
// Forcing truncation
mode |= O_TRUNC ;
// Forcing truncation in Read / Write mode
mode |= (O_TRUNC | O_RDWR) ;
if (newfile)
mode |= O_CREAT ;
break;
case 1:
//
// Read / Write
Expand Down
2 changes: 1 addition & 1 deletion src/XrdSys/XrdSysError.cc
Expand Up @@ -97,7 +97,7 @@ int XrdSysError::Emsg(const char *esfx, int ecode, const char *txt1,
{
struct iovec iov[16];
int iovpnt = 0;
char ebuff[16], etbuff[80], *etxt = 0;
char ebuff[32], etbuff[80], *etxt = 0;

if (!(etxt = ec2text(ecode)))
{snprintf(ebuff, sizeof(ebuff), "reason unknown (%d)", ecode);
Expand Down
4 changes: 4 additions & 0 deletions src/XrdXrootd/XrdXrootdConfig.cc
Expand Up @@ -189,9 +189,13 @@ int XrdXrootdProtocol::Configure(char *parms, XrdProtocol_Config *pi)
{ switch(c)
{
case 'r': deper = 1;
XrdOucEnv::Export("XRDREDIRECT", "R");
break;
case 'm': XrdOucEnv::Export("XRDREDIRECT", "R");
break;
case 't': deper = 1;
XrdOucEnv::Export("XRDRETARGET", "1");
break;
case 's': XrdOucEnv::Export("XRDRETARGET", "1");
break;
case 'y': XrdOucEnv::Export("XRDREDPROXY", "1");
Expand Down

0 comments on commit 1e2f169

Please sign in to comment.