From 9726274d5f05f9c49a94180b649c1fbf692492e3 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Wed, 3 Feb 2010 21:05:43 -0800 Subject: [PATCH] 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. --- src/output/csv.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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); } -- 2.30.2