Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Truncate export PCAP file on overwrite #4372

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

alenz316
Copy link
Contributor

Task/Issue URL: Related to #4371

Description

In Android 10/11, the "w" write mode no longer truncates the file during an overwrite. More details about this workaround can be found at https://issuetracker.google.com/issues/180526528

During the fix for #3069 all other instances of ContentResolver.open... were reviewed to see if they also used the "w" mode. The only other one was for exporting PCAP files as it used contentResolver.openOutputStream(uri) which is a convenience function that calls contentResolver.openOutputStream(uri, "w").

Steps to test this PR

  1. Export a PCAP file and overwrite any existing file of substantial size, the exported PCAP file should now be truncated and there should no longer be trailing bytes of the overwritten file.

In Android 10/11, the "w" write mode no longer truncates the file during
a file overwrite. More details about this workaround can be found at
https://issuetracker.google.com/issues/180526528
@malmstein
Copy link
Contributor

@karlenDimla can you confirm this works? Assigning it to you, feel free to close.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants