execution failure and core dump generation

Hi, I am running a c++ program in unix sun OS 5.9. There are two functions in a file which are being used by a third function in the same file. the two functions being used are of the same type. one function is returning a success and the control is redeemed by the calling function. for teh second function, it is executing fine and is returning a success, but the control is not taken back by the caliing function and a core dump is getting generated. what can be the reason ?

details of functions:
calling function :
int lnClassType::updateDP(updatestruct lupdatestruct, localstruct llocalstruct)
{
retVal = validateDP(lupdatestruct);
if ( FAILURE == updateDP( lupdatestruct,localstruct)) {
return FAILURE;
}
}

called functions:
int limitnodeClassType::validateDrwngPower(updatestruct lupdatestruct, localstruct llocalstruct)
int limitnodeClassType::updateAcctDrwngPower(updatestruct lupdatestruct, localstruct llocalstruct)

function validateDP is goin thru fine. UpdateDP is giving the core. Included logs to find out wer exactly the execution is stopping. Found that updateDP is returning success, but the value is not being caught at the calling function and exectuin is stopping there. plz help.

please suggest a solution for this.

The code for validateDP and updateDP is probably relevant. That it returns doesn't mean it isn't corrupting the stack, for example.

But the function validateDP has never given any error or core. the execution stops and core generation happens at updateDP only. logs prove that the function is executed and is reching till the return success statement of the function. but the success value is not getting returned to the calling function. thats where the execution stops.

I think the problem in this part of code :

if ( FAILURE == updateDP( lupdatestruct,localstruct)) {
return FAILURE;
}

because if the

if

statement not satisfied ,the excusion
will not end due to the recursive loop ,so Segmentation Fault(coredump) will be occured.

Is this a typo or is it really your code?

if ( FAILURE == updateDP( lupdatestruct,localstruct)) {

Should "localstruct" not be "llocalstruct"?

I am very sorry.. Its a huge typo.. :frowning: :frowning:
details of functions:
calling function :
int lnClassType::updateDP(updatestruct lupdatestruct, localstruct llocalstruct)
{
retVal = validateDP(lupdatestruct,llocalstruct);
if ( FAILURE == updateAcctDP( lupdatestruct,localstruct)) {
return FAILURE;
}
}

called functions:
int limitnodeClassType::validateDP(updatestruct lupdatestruct, localstruct llocalstruct)
int limitnodeClassType::updateAcctDP(updatestruct lupdatestruct, localstruct llocalstruct)

.. this is the code flow..