Fixes to minor Coverity errors:

75424
73422
72724
72702
72662
This commit is contained in:
Markus Makela 2014-11-07 11:12:26 +02:00
parent e1af60ac71
commit 474f018cee
4 changed files with 13 additions and 5 deletions

View File

@ -45,8 +45,9 @@ int main(int argc, char** argv)
}
block_size = atoi(argv[3]);
if(block_size < 1){
fprintf(stderr,"Message size too small, must be at least 1 byte long.");
if(block_size < 1 || block_size > 1024){
fprintf(stderr,"Message size too small or large, must be at least 1 byte long and must not exceed 1024 bytes.");
return 1;
}

View File

@ -57,6 +57,9 @@ int main(int argc, char** argv)
{
fgets(readbuff,4092,infile);
psize = strlen(readbuff);
if(psize < 0 || > 4092){
continue;
}
qbuff = gwbuf_alloc(psize + 7);
*(qbuff->sbuf->data + 0) = (unsigned char)psize;
*(qbuff->sbuf->data + 1) = (unsigned char)(psize>>8);

View File

@ -1268,7 +1268,7 @@ SERVER *server;
(PERCENT_TYPE|COUNT_TYPE));
}
if (!succp)
if (!succp && param != NULL)
{
LOGIF(LM, (skygw_log_write(
LOGFILE_MESSAGE,
@ -1362,7 +1362,7 @@ SERVER *server;
if (enable_root_user && service)
serviceEnableRootUser(service, atoi(enable_root_user));
if (allow_localhost_match_wildcard_host)
if (allow_localhost_match_wildcard_host && service)
serviceEnableLocalhostMatchWildcardHost(
service,
atoi(allow_localhost_match_wildcard_host));

View File

@ -1479,7 +1479,11 @@ int main(int argc, char **argv)
bool succp;
sprintf(buf, "%s/log", home_dir);
mkdir(buf, 0777);
if(mkdir(buf, 0777) != 0){
fprintf(stderr,
"Error: Cannot create log directory: %s\n",buf);
goto return_main;
}
argv[0] = "MaxScale";
argv[1] = "-j";
argv[2] = buf;