call fclose(infile) after print_progress()
authorGiacomo Comes <comes@naic.edu>
Tue, 7 Jun 2016 14:31:28 +0000 (10:31 -0400)
committerJon Trulson <jon@radscan.com>
Wed, 8 Jun 2016 02:00:11 +0000 (20:00 -0600)
The function print_progress uses the pointer infile.
If fclose is called before print_progress then the build process
can fail to build the files:
  doc/C/cde.dti/CDEDOC/dtsearch/CDEDOC.d99
  doc/C/cde.dti/CDEDOC/dtsearch/dtsearch.ocf
  doc/C/cde.dti/cde.oli
To fix the issue move the call fclose(infile) after print_progress()

cde/programs/dtsr/dtsrload.c

index abe0b090769aee2529dc5d2ff4a6ce6e2c69556d..703cab08bd102758ece021315ec952e67d28f475 100644 (file)
@@ -1263,9 +1263,9 @@ int             main (int argc, char *argv[])
 
     }  /* end main record loop */
 
-    fclose (infile);
     if (need_final_progress_msg)
        print_progress ();
+    fclose (infile);
     write_dbrec ();
 
     /* If all input records were discarded, complete processing