Skip to content
Snippets Groups Projects
Commit ba287d2e authored by Erik Alexandre Pucci's avatar Erik Alexandre Pucci Committed by Danilo K. S. Yorinori
Browse files

client.c: Changed return for direct exit(3) in read file functions


Added documentation and "exit(3)" in read_version_file(), instead of "return
NULL".
Added documentation and "exit(12)" in read_xml_file() instead of "return
NULL".

Signed-off-by: default avatarErik Alexandre Pucci <eap08@c3sl.ufpr.br>
Acked-by: default avatarRicardo Tavares de Oliveira <rto07@c3sl.ufpr.br>
Signed-off-by: default avatarDanilo K. S. Yorinori <danilok@c3sl.ufpr.br>
parent 9c0ce183
No related branches found
No related tags found
No related merge requests found
......@@ -76,12 +76,7 @@ int main(int argc, char **argv)
if (option == 2)
{
/* Get client version from file */
if ( ! (clientVersion = read_version_file(basedir)) )
{
/* Error when open version file */
exit(3);
}
clientVersion = read_version_file(basedir);
/* Agent Version method */
check_version(soap, url, clientVersion);
}
......@@ -323,7 +318,8 @@ static char *read_version_file(char *basedir)
if ( ! (version = (char *) malloc(11 * sizeof(char))) )
{
ERROR("ERROR (3): Memory allocation error.\n");
return NULL;
/* Error while trying to allocate memory for version string */
exit(3);
}
/* Open version file */
......@@ -331,7 +327,8 @@ static char *read_version_file(char *basedir)
{
ERROR("ERROR (3): Problem while trying to open version file.\n");
ERROR("File: %s.\n", filepath);
return NULL;
/* Error while trying to open version file */
exit(3);
}
/* Read from version file */
......@@ -495,7 +492,8 @@ char *read_xml_file(char *basedir)
{
ERROR("ERROR (12): Problem while trying to open the ");
ERROR("collect_data.xml file.\n");
return NULL;
/* Error while trying to open XML data file */
exit(12);
}
/* Read and copy from data file to string */
......@@ -510,7 +508,8 @@ char *read_xml_file(char *basedir)
if (xmlInventory == NULL)
{
ERROR("ERROR (12): Memory allocation error for xmlInventory.\n");
return NULL;
/* Error while trying to allocate memory for XML data string */
exit(12);
}
xmlInventory[i++] = aux;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment