--- wdiff.c.old 2004-10-12 14:23:32.000000000 +0100 +++ wdiff.c 2004-10-12 14:36:55.000000000 +0100 @@ -182,7 +182,7 @@ SIDE *left_side = &side_array[0]; SIDE *right_side = &side_array[1]; -FILE *input_file; /* stream being produced by diff */ +FILE *input_file = NULL; /* stream being produced by diff */ int character; /* for reading input_file */ char directive; /* diff directive character */ int argument[4]; /* four diff directive arguments */ @@ -910,7 +910,11 @@ static void complete_input_program (void) { - fclose (input_file); + if (input_file != NULL) + { + fclose (input_file); + input_file = NULL; + } wait (NULL); } @@ -1303,6 +1307,7 @@ initialize_strings (); reformat_diff_output (); fclose (input_file); + input_file = NULL; } /* Clean up. Beware that input_file and output_file might not exist,