Merge lp:~ev/apport/fsync-upstart-crashes into lp:~apport-hackers/apport/trunk

Proposed by Evan
Status: Merged
Merged at revision: 2534
Proposed branch: lp:~ev/apport/fsync-upstart-crashes
Merge into: lp:~apport-hackers/apport/trunk
Diff against target: 21 lines (+11/-0)
1 file modified
data/apport (+11/-0)
To merge this branch: bzr merge lp:~ev/apport/fsync-upstart-crashes
Reviewer Review Type Date Requested Status
Martin Pitt (community) Approve
James Hunt (community) Approve
Review via email: mp+135134@code.launchpad.net

Description of the change

As discussed in the "Apport/Whoopsie and Upstart" email, we should fsync crashes of upstart.

To post a comment you must log in.
Revision history for this message
James Hunt (jamesodhunt) wrote :

Looks good to me.

review: Approve
Revision history for this message
Martin Pitt (pitti) wrote :

Thanks, looks fine!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'data/apport'
--- data/apport 2012-07-12 15:11:48 +0000
+++ data/apport 2012-11-20 12:16:25 +0000
@@ -422,6 +422,17 @@
422 try:422 try:
423 info.write(reportfile)423 info.write(reportfile)
424 if reportfile != sys.stderr:424 if reportfile != sys.stderr:
425 # Ensure that the file gets written to disk in the event of an
426 # Upstart crash.
427 if info.get('ExectuablePath', '') == '/sbin/init':
428 reportfile.flush()
429 os.fsync(reportfile.fileno())
430 parent_directory = os.path.dirname(report)
431 try:
432 fd = os.open(parent_directory, os.O_RDONLY)
433 os.fsync(fd)
434 finally:
435 os.close(fd)
425 reportfile.close()436 reportfile.close()
426 except IOError:437 except IOError:
427 if reportfile != sys.stderr:438 if reportfile != sys.stderr:

Subscribers

People subscribed via source and target branches