Merge lp:~yavor-nikolov/pbzip2/bug-1300876-explicit-close-of-stdout into lp:pbzip2/1.1

Proposed by Yavor Nikolov on 2014-04-10
Status: Merged
Approved by: Yavor Nikolov on 2014-04-13
Approved revision: 41
Merged at revision: 39
Proposed branch: lp:~yavor-nikolov/pbzip2/bug-1300876-explicit-close-of-stdout
Merge into: lp:pbzip2/1.1
Diff against target: 45 lines (+16/-2)
2 files modified
ChangeLog (+3/-1)
pbzip2.cpp (+13/-1)
To merge this branch: bzr merge lp:~yavor-nikolov/pbzip2/bug-1300876-explicit-close-of-stdout
Reviewer Review Type Date Requested Status
Yavor Nikolov Approve on 2014-04-13
Review via email: mp+215307@code.launchpad.net

Description of the change

Fix for #1300876

To post a comment you must log in.
39. By Yavor Nikolov on 2014-04-11

close redirected stdout to check for errors (bug #1300876)
This is in particular important for NFS/AFS

40. By Yavor Nikolov on 2014-04-11

Fix an error message on file close

41. By Yavor Nikolov on 2014-04-11

Updated Changelog for #1300876

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ChangeLog'
2--- ChangeLog 2012-07-07 10:53:37 +0000
3+++ ChangeLog 2014-04-11 19:55:21 +0000
4@@ -1,6 +1,8 @@
5 Changes in 1.1.9 (NOT RELEASED YET)
6 - spec file refinement for rpm builds thanks to to Ville Skytta
7-- Makefile refinements for
8+- Makefile refinements
9+- close redirected stdout on finish for better AFS/NFS support (bug #1300876)
10+ Thanks to Richard Brittain
11 Changes in 1.1.8 (Jun 10, 2012)
12 - Fix of metadata unpreserved on empty files compress (bug #1011021)
13 Changes in 1.1.7 (Dec 11, 2011)
14
15=== modified file 'pbzip2.cpp'
16--- pbzip2.cpp 2012-06-10 13:25:13 +0000
17+++ pbzip2.cpp 2014-04-11 19:55:21 +0000
18@@ -2083,7 +2083,7 @@
19 if (ret == -1)
20 {
21 ErrorContext::getInstance()->saveError();
22- handle_error(EF_EXIT, -1, "pbzip2: *ERROR: Could close output file! Aborting...\n");
23+ handle_error(EF_EXIT, -1, "pbzip2: *ERROR: Could not close output file! Aborting...\n");
24 return (NULL);
25 }
26 }
27@@ -4707,6 +4707,18 @@
28 fprintf(stderr, "-------------------------------------------\n");
29 } /* for */
30
31+ // Explicit close on stdout if we've been writing there, after all input has been processed
32+ if (OutputStdOut == 1)
33+ {
34+ ret = close(STDOUT_FILENO);
35+ if (ret == -1)
36+ {
37+ ErrorContext::getInstance()->saveError();
38+ handle_error(EF_EXIT, 1, "pbzip2: *ERROR: Failed to close STDOUT! Aborting...\n");
39+ exit(1);
40+ }
41+ }
42+
43 // Terminate signal handler thread sending SIGQUIT signal
44 ret = pthread_kill(SignalHandlerThread, SIG_HANDLER_QUIT_SIGNAL);
45 if (ret != 0)

Subscribers

People subscribed via source and target branches