Darren
02-08-2010, 11:55 PM
Ok, first... I'm stumped. I wrote and maintain a set of programs in C (originally written in 1998). Recently I made some minor changes. Nothing above basic difficulty, but the program is now core dumping. I add some debug (printf) statements to determine where the core dump is occurring and the core dumping disappears--the program runs fine. I removed the debug statements one-by-one until the core dumping came back. I put that one debug line back and removed all the others so that there is just one line difference between a program that runs fine and one that core dumps. Here's the one line:
snippet #1 (debug output sent to stderr)fprintf( stderr, "%s, %s\n", g->name, g->value );
snippet #2 (debug output sent to a file)fprintf( debug, "%s, %s\n", g->name, g->value );
snippet #1 core dumps.
snippet #2 runs fine (the entire program runs and produces accurate output).
The program also core dumps if I just remove the line.
The program itself does not redirect stderr... but it does run as a cgi program on an apache web server which captures all stderr to a log file. For 12 years, this has worked fine.
This is a real head-scratcher for me. Any ideas how this is possible? Any at all?
Darren
snippet #1 (debug output sent to stderr)fprintf( stderr, "%s, %s\n", g->name, g->value );
snippet #2 (debug output sent to a file)fprintf( debug, "%s, %s\n", g->name, g->value );
snippet #1 core dumps.
snippet #2 runs fine (the entire program runs and produces accurate output).
The program also core dumps if I just remove the line.
The program itself does not redirect stderr... but it does run as a cgi program on an apache web server which captures all stderr to a log file. For 12 years, this has worked fine.
This is a real head-scratcher for me. Any ideas how this is possible? Any at all?
Darren