From: Ben Pfaff Date: Thu, 4 Feb 2010 05:05:43 +0000 (-0800) Subject: csv: Close pipe files properly. X-Git-Tag: v0.7.4~31 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9726274d5f05f9c49a94180b649c1fbf692492e3;p=pspp-builds.git csv: Close pipe files properly. csv_create() opens the output file with fn_open() so csv_destroy() should close it with fn_close() to ensure that pipes and the standard file descriptors are closed properly. --- diff --git a/src/output/csv.c b/src/output/csv.c index 4b99772d..625ce82a 100644 --- a/src/output/csv.c +++ b/src/output/csv.c @@ -92,10 +92,11 @@ csv_destroy (struct output_driver *driver) { struct csv_driver *csv = csv_driver_cast (driver); + if (csv->file != NULL) + fn_close (csv->file_name, csv->file); + free (csv->separator); free (csv->file_name); - if (csv->file != NULL) - fclose (csv->file); free (csv); }