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

client.c: Modified error exit when calling a server method


Now the client checks to see if the GSOAP error is the network device bind,
exiting with it (value 50) or exiting with 2 otherwise.

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 ae16e5d1
Branches
Tags
No related merge requests found
......@@ -311,11 +311,13 @@ static char *read_version_file(char *basedir)
void print_update_link(struct soap *soap, char *url)
{
char *updateLink;
int error;
if (soap_call_ns1__getUpdateLink(soap, url, "", &updateLink) != SOAP_OK)
error = soap_call_ns1__getUpdateLink(soap, url, "", &updateLink);
if (error != SOAP_OK)
{
soap_print_fault(soap, stderr);
exit(2);
exit(error == NIC_ERROR ? error : 2);
}
/* Get update link from response */
......@@ -344,12 +346,13 @@ void print_update_link(struct soap *soap, char *url)
void check_version(struct soap *soap, char *url, char *clientVersion)
{
char *versionFromServer;
int error;
if (soap_call_ns1__getAgentVersion(soap, url, "", &versionFromServer) !=
SOAP_OK)
error = soap_call_ns1__getAgentVersion(soap, url, "", &versionFromServer);
if (error != SOAP_OK)
{
soap_print_fault(soap, stderr);
exit(2);
exit(error == NIC_ERROR ? error : 2);
}
DEBUG("Version from server: %s\n", versionFromServer);
......@@ -451,14 +454,16 @@ char *read_xml_file(char *basedir)
void inventory(struct soap *soap, char *url, char *basedir)
{
char *invResult, *xmlInventory;
int error;
xmlInventory = read_xml_file(basedir);
if (soap_call_ns1__setInventory(soap, url, "", xmlInventory, &invResult)
!= SOAP_OK)
error = soap_call_ns1__setInventory(soap, url, "", xmlInventory,
&invResult);
if (error != SOAP_OK)
{
soap_print_fault(soap, stderr);
exit(2);
exit(error == NIC_ERROR ? error : 2);
}
/* Get inventory result from response */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment