Skip to content

Commit

Permalink
Check file existing before set write permission on dso file
Browse files Browse the repository at this point in the history
Summary: `java.io.File.setWritable` will return false if the file doesn't exist. To avoid to print too much false warning on fresh installation. We need check the file existing before the printing warn log.

Differential Revision: D25537519

fbshipit-source-id: 7d0740dfe6e2d3e19189c5573c418781d6e3c5fe
  • Loading branch information
simpleton authored and facebook-github-bot committed Dec 14, 2020
1 parent cf6a35c commit 545548d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion java/com/facebook/soloader/UnpackingSoSource.java
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ private void extractDsoImpl(InputDso iDso, byte[] ioBuffer) throws IOException {
File dsoFileName = new File(soDirectory, iDso.dso.name);
RandomAccessFile dsoFile = null;
try {
if (!dsoFileName.setWritable(true)) {
if (dsoFileName.exists() && !dsoFileName.setWritable(true)) {
Log.w(TAG, "error adding write permission to: " + dsoFileName);
}

Expand Down

0 comments on commit 545548d

Please sign in to comment.