1832275 Members
1650 Online
110041 Solutions
New Discussion

Assertion failed

 
Pedro_5
Occasional Contributor

Assertion failed

Hi.

We have a program running on HP-UX 10.20 that throws the next message at run-time:

"Assertion failed: !(fgets(hardwareAddr, (STRLEN-1), fstream) == NULL), file snlui.c, line 1251"

The problem is that sometimes the program works well.

The Oracle version is 8.0.6.

Any ideas?

Pedro.
4 REPLIES 4
Steven Gillard_2
Honored Contributor

Re: Assertion failed

If you don't have the source code to the program, use "tusc" to obtain a system call trace. This will give you more information on why the fgets is returning NULL - whether it is an end of file condition or a read error. You can obtain tusc from http://hpux.connect.org.uk/

If you have source code, I would recommend removing the assertion from around the fgets and replacing it with something like:

if (fgets(hardwareAddr, (STRLEN-1), fstream) == NULL) {
if (!feof(fstream)) {
perror("fgets");
abort();
} else {
printf("end of file\n");
fclose(fstream);
}
}

Regards,
Steve
Steven Gillard_2
Honored Contributor

Re: Assertion failed

Oops, just noticed you're running 10.20. Use "trace" instead, which is the 10.20 equivalent of tusc. You can get it at the same place.
Pedro_5
Occasional Contributor

Re: Assertion failed

I don't have the source code to the program. I have used "trace", but I don't have idea why the program fails.

Any suggestions?

Regards,
Pedro.
Steven Gillard_2
Honored Contributor

Re: Assertion failed

Can you post the trace output? If its large just post the last 100 lines or so.

Regards,
Steve