Fred Strauss reported a problem when we close stderr in add.c; we now
do some basic checking to try to ensure it's a valid file ptr before
we close it. Also do this for stdout just in case.
count);
printf("Storing %d keys.\n", count);
end_html();
count);
printf("Storing %d keys.\n", count);
end_html();
- fclose(stdout);
- fclose(stderr);
+ if (stdout != NULL && fileno(stdout) != -1) {
+ fclose(stdout);
+ }
+ if (stderr != NULL && stderr != stdout &&
+ fileno(stderr) != -1) {
+ fclose(stderr);
+ }
catchsignals();
initdb(false);
catchsignals();
initdb(false);