Fixed an issue with sget throwing excessive error messages when testing
for the presence of a Hdb node
This commit is contained in:
@ -334,7 +334,7 @@ static int GetHdbFunc(void *ms, void *userData)
|
||||
char *geterror = NULL, error[512];
|
||||
hdbValue ve;
|
||||
|
||||
node = FindHdbNode(NULL,self->name,pServ->dummyCon);
|
||||
node = FindHdbIntern(self->name);
|
||||
if(node != NULL){
|
||||
geterror = GetHdbProp(node,"geterror");
|
||||
if(geterror != NULL){
|
||||
|
@ -1521,7 +1521,10 @@ pHdb AddSICSHdbMemPar(pHdb parent, char *name, int priv,
|
||||
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,
|
||||
SConnection * pCon)
|
||||
{
|
||||
@ -1597,7 +1600,7 @@ pHdb FindHdbParent(char *rootpath, char *relpath, char **namePtr,
|
||||
SCPrintf(pCon, eError, "ERROR: parent of %s not found",
|
||||
buffer);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
/* the name must be taken from the end of relpath, as element is no longer valid */
|
||||
*namePtr = relpath + (element - buffer);
|
||||
return parent; /* parent found, and node does not yet exist */
|
||||
@ -1630,7 +1633,37 @@ pHdb FindHdbNode(char *rootpath, char *relpath, SConnection * 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
|
||||
* There are so many length checks in the code anyway so that is
|
||||
|
@ -281,6 +281,14 @@ pHdb FindHdbParent(char *rootpath, char *relpath, char **namePtr,
|
||||
* the path starts with "/sics/"
|
||||
*/
|
||||
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
|
||||
* Hipadaba root or in a sics object
|
||||
* @param nodeArg the input node
|
||||
|
Reference in New Issue
Block a user