Fixed an issue with sget throwing excessive error messages when testing

for the presence of a Hdb node
This commit is contained in:
2016-04-14 14:20:30 +02:00
parent 96114fc803
commit e476d19040
3 changed files with 44 additions and 3 deletions

View File

@ -334,7 +334,7 @@ static int GetHdbFunc(void *ms, void *userData)
char *geterror = NULL, error[512]; char *geterror = NULL, error[512];
hdbValue ve; hdbValue ve;
node = FindHdbNode(NULL,self->name,pServ->dummyCon); node = FindHdbIntern(self->name);
if(node != NULL){ if(node != NULL){
geterror = GetHdbProp(node,"geterror"); geterror = GetHdbProp(node,"geterror");
if(geterror != NULL){ if(geterror != NULL){

View File

@ -1521,7 +1521,10 @@ pHdb AddSICSHdbMemPar(pHdb parent, char *name, int priv,
return child; return child;
} }
/*==================== access support functions ==============================*/ /*==================== access support functions ==============================
This has become an eierlegendewollmilchsau function. I do not know how and when
that happened
==============================================================================*/
pHdb FindHdbParent(char *rootpath, char *relpath, char **namePtr, pHdb FindHdbParent(char *rootpath, char *relpath, char **namePtr,
SConnection * pCon) SConnection * pCon)
{ {
@ -1630,7 +1633,37 @@ pHdb FindHdbNode(char *rootpath, char *relpath, SConnection * pCon)
{ {
return FindHdbParent(rootpath, relpath, NULL, pCon); return FindHdbParent(rootpath, relpath, NULL, pCon);
} }
/*-------------------------------------------------------------------------*/
pHdb FindHdbIntern(char *path)
{
char *element, *slash;
pHdb parent = NULL;
pObjectDescriptor pDes = NULL;
element = path;
if(strncmp(element,"/sics/",6) == 0){
slash = strchr(element+6,'/');
if(slash != NULL){
*slash = '\0';
}
pDes = FindCommandDescriptor(pServ->pSics,element+6);
if(pDes == NULL){
return NULL;
}
parent = pDes->parNode;
if(parent == NULL){
return NULL;
}
if(slash == NULL){
return parent;
}
*slash = '/';
element = slash + 1;
} else {
parent = GetHipadabaRoot();
}
return GetHipadabaNode(parent,element);
}
/*-------------------------------------------------------------------------- /*--------------------------------------------------------------------------
* This does not use strlcpy, strlcat on purpose: it caused a bug * This does not use strlcpy, strlcat on purpose: it caused a bug
* There are so many length checks in the code anyway so that is * There are so many length checks in the code anyway so that is

View File

@ -281,6 +281,14 @@ pHdb FindHdbParent(char *rootpath, char *relpath, char **namePtr,
* the path starts with "/sics/" * the path starts with "/sics/"
*/ */
pHdb FindHdbNode(char *rootpath, char *relpath, SConnection * pCon); pHdb FindHdbNode(char *rootpath, char *relpath, SConnection * pCon);
/** FindHdbIntern finds a node. It does so without complaining
* on the various bits which can fail. It is for internal use where the caller
* deals with the absence of the desired node.
* @param path the path to search. Paths starting /sics/are searched for in the object database
* @return the found node or NULL on failure
*/
pHdb FindHdbIntern(char *path);
/** Get the absolute path of a node anchored in the /** Get the absolute path of a node anchored in the
* Hipadaba root or in a sics object * Hipadaba root or in a sics object
* @param nodeArg the input node * @param nodeArg the input node