=== modified file 'ChangeLog'
--- ChangeLog	2012-07-07 10:53:37 +0000
+++ ChangeLog	2014-04-11 19:55:21 +0000
@@ -1,6 +1,8 @@
 Changes in 1.1.9 (NOT RELEASED YET)
 - spec file refinement for rpm builds thanks to to Ville Skytta
-- Makefile refinements for
+- Makefile refinements
+- close redirected stdout on finish for better AFS/NFS support (bug #1300876)
+  Thanks to Richard Brittain 
 Changes in 1.1.8 (Jun 10, 2012)
 - Fix of metadata unpreserved on empty files compress (bug #1011021)
 Changes in 1.1.7 (Dec 11, 2011)

=== modified file 'pbzip2.cpp'
--- pbzip2.cpp	2012-06-10 13:25:13 +0000
+++ pbzip2.cpp	2014-04-11 19:55:21 +0000
@@ -2083,7 +2083,7 @@
 		if (ret == -1)
 		{
 			ErrorContext::getInstance()->saveError();
-			handle_error(EF_EXIT, -1, "pbzip2: *ERROR: Could close output file!  Aborting...\n");
+			handle_error(EF_EXIT, -1, "pbzip2: *ERROR: Could not close output file!  Aborting...\n");
 			return (NULL);			
 		}
 	}
@@ -4707,6 +4707,18 @@
 			fprintf(stderr, "-------------------------------------------\n");
 	} /* for */
 
+	// Explicit close on stdout if we've been writing there, after all input has been processed
+	if (OutputStdOut == 1)
+	{
+		ret = close(STDOUT_FILENO);
+		if (ret == -1)
+		{
+			ErrorContext::getInstance()->saveError();
+			handle_error(EF_EXIT, 1, "pbzip2: *ERROR: Failed to close STDOUT! Aborting...\n");
+			exit(1);
+		}
+	}
+
 	// Terminate signal handler thread sending SIGQUIT signal
 	ret = pthread_kill(SignalHandlerThread, SIG_HANDLER_QUIT_SIGNAL);
 	if (ret != 0)

