useless-if-before-free: Close stdout carefully.
authorJim Meyering <meyering@redhat.com>
Mon, 11 Feb 2008 07:34:27 +0000 (08:34 +0100)
committerJim Meyering <meyering@redhat.com>
Mon, 11 Feb 2008 07:34:30 +0000 (08:34 +0100)
ChangeLog
build-aux/useless-if-before-free

index 236260d..b6209a4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2008-02-11  Jim Meyering  <meyering@redhat.com>
+
+       * build-aux/useless-if-before-free: Close stdout carefully.
+
 2008-02-10  Bruno Haible  <bruno@clisp.org>
 
        New module 'git-merge-changelog'.
index 1cf4cb0..a50db66 100755 (executable)
@@ -2,7 +2,7 @@
 # Detect instances of "if (p) free (p);".
 # Likewise for "if (p != NULL) free (p);".  And with braces.
 
-my $VERSION = '2008-02-10 22:17'; # UTC
+my $VERSION = '2008-02-11 07:32'; # UTC
 # The definition above must lie within the first 8 lines in order
 # for the Emacs time-stamp write hook (at end) to update it.
 # If you change this file with Emacs, please let the write hook
@@ -31,6 +31,14 @@ use Getopt::Long;
 
 (my $ME = $0) =~ s|.*/||;
 
+# use File::Coda; # http://meyering.net/code/Coda/
+END {
+  defined fileno STDOUT or return;
+  close STDOUT and return;
+  warn "$ME: failed to close standard output: $!\n";
+  $? ||= 1;
+}
+
 sub usage ($)
 {
   my ($exit_code) = @_;