diff --git a/src/client.c b/src/client.c index b81d1262fb990a2cd294b68deb29363b5c352f58..dda8781244755ccd6eab68243d31b1b489a891fa 100644 --- a/src/client.c +++ b/src/client.c @@ -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 */