bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Patched: wdiff always seg faults due to double-fclose()


From: Dan Harkless
Subject: Patched: wdiff always seg faults due to double-fclose()
Date: Thu, 06 May 2004 16:54:16 -0700

Not sure what the chances are of a fixed version of wdiff getting put out,
considering 0.5 dates from 1994, but on my Red Hat 9 box, it always seg
faults after outputting the diffs, due to a double-fclose().  Here's a
patch:

=== CUT HERE ===
diff -U 2 -r wdiff-0.5/ChangeLog wdiff-0.5+patch/ChangeLog
--- wdiff-0.5/ChangeLog 1994-11-05 23:48:40.000000000 -0800
+++ wdiff-0.5+patch/ChangeLog   2004-05-06 16:22:38.000000000 -0700
@@ -1,2 +1,7 @@
+Thu May  6 16:15:07 2004  Dan Harkless  (address@hidden)
+
+       * wdiff.c: Would always seg fault on GNU/Linux (and no doubt other
+       OSes) due to fclose()ing input file more than once.
+
 Sat Nov  5 15:57:59 1994  Francois Pinard  (address@hidden)
 
diff -U 2 -r wdiff-0.5/wdiff.c wdiff-0.5+patch/wdiff.c
--- wdiff-0.5/wdiff.c   1994-11-05 23:57:23.000000000 -0800
+++ wdiff-0.5+patch/wdiff.c     2004-05-06 16:11:43.000000000 -0700
@@ -878,5 +878,7 @@
 
   fclose (left_side->file);
+  left_side->file = NULL;
   fclose (right_side->file);
+  right_side->file = NULL;
 }
 
@@ -911,5 +913,9 @@
 complete_input_program (void)
 {
-  fclose (input_file);
+  if (input_file)
+    {
+      fclose (input_file);
+      input_file = NULL;
+    }
   wait (NULL);
 }
@@ -1303,5 +1309,9 @@
       initialize_strings ();
       reformat_diff_output ();
-      fclose (input_file);
+      if (input_file)
+       {
+         fclose (input_file);
+         input_file = NULL;
+       }
     }
=== CUT HERE ===
 
--
Dan Harkless
http://harkless.org/dan/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]