xmlXPathObjectPtr obj = NULL;
char realquery[PATH_MAX + 16];
- if(strncmp(query, "/", 1))
+ if(strncmp(query, "/", 1)) {
+ errno = EINVAL;
return -EINVAL;
+ }
if (list && !strcmp(query, previous_query))
xmllistindex++;
obj = xmlXPathEvalExpression((xmlChar *)realquery, ctx);
- if(!obj)
+ if(!obj) {
+ errno = EINVAL;
return -EINVAL;
+ }
if (obj->nodesetval && (obj->nodesetval->nodeNr > 0)) {
xmlNodePtr node;
nodename_len = strlen(nodename);
ret = snprintf(path, sizeof(path),
"/cluster/clusternodes/clusternode[@name=\"%s\"]/@name", nodename);
- if (ret < 0 || (size_t) ret >= sizeof(path))
+ if (ret < 0 || (size_t) ret >= sizeof(path)) {
+ errno = E2BIG;
return (-E2BIG);
+ }
str = NULL;
error = ccs_get(cd, path, &str);
return (0);
}
- if (nodename_len >= sizeof(host_only))
+ if (nodename_len >= sizeof(host_only)) {
+ errno = E2BIG;
return (-E2BIG);
+ }
/* Try just the hostname */
strcpy(host_only, nodename);
if (altcnt == 0) {
if (strlen(str) >= sizeof(canonical_name)) {
free(str);
+ errno = E2BIG;
return (-E2BIG);
}
strcpy(canonical_name, str);
if (strlen(str) >= sizeof(cur_node)) {
free(str);
+ errno = E2BIG;
return (-E2BIG);
}
{
free(str);
*retval = strdup(canonical_name);
- if (*retval == NULL)
+ if (*retval == NULL) {
+ errno = ENOMEM;
return (-ENOMEM);
+ }
return (0);
}
freeaddrinfo(ai);
free(str);
*retval = strdup(canonical_name);
- if (*retval == NULL)
+ if (*retval == NULL) {
+ errno = ENOMEM;
return (-ENOMEM);
+ }
return (0);
}
}
}
out_fail:
+ errno = EINVAL;
*retval = NULL;
return (-1);
}