Core file (segmentation fault) strings help

I'm trying to figure out what the problem is with a program that I've compiled.It works on HP-UX and on MPE/IX but I can't get it to run on Linux.I'll attach the core file (if I can).Any help would be greatly appreciated.

Re: Core file (segmentation fault) strings help

It's a C program written to simulate airline reservation bookings so we can get a benchmark on the Transactions Per Second.So basically a benchmark app. It opens TCP sockets, makes a random booking on a random date, random to and from destinations, etc.

So, compiled on Linux to connect to the 3000. He did have a lot of compile errors, but has fixed them so it compiles with no errors.

What is a Segmentation Fault? Is it any clue as to the problem?

Thanks again. I can probably send you the .c file (code) if you think you can help.

Re: Core file (segmentation fault) strings help

A segmentation fault usually means that the running program attempted to do something with a pointer that was not properly initialized.

This can happen for a lot of reasons.

The easiest way to find out where the seg fault came from is load your core file in gdb and do a backtrace. That will show you where in the call stack the program died (provided the program was compiled with the -g option).

Several of the routine names should be recognizable to you and you should be able to narrow it down to the line of code that dies.

Re: Core file (segmentation fault) strings help

Are there any flags on the recv() call? (you are using recv, right?)

I see there are some flags not in common between Linux and HP.

Also, note that the recv will fail if the connect prior to the first recv failed (i.e. trying to recv from a null socket). Error checking might be in order, but that only pushes up your problem to the socket connection itself.

Re: Core file (segmentation fault) strings help

Put a printf right before the recv to make sure that the fSock and &osreturn is non null. The only thing I can see here that could be a problem would be if osreturn is invalid or is defined to be smaller than hsize.