Skip to content

Commit

Permalink
Set POSIX filepermissions to 644
Browse files Browse the repository at this point in the history
Fix for #2635
  • Loading branch information
Siedlerchr committed Mar 12, 2017
1 parent 9561ac5 commit 5725308
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/main/java/org/jabref/logic/exporter/FileSaveSession.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ public class FileSaveSession extends SaveSession {
private static final String TEMP_SUFFIX = "save.bib";
private final Path temporaryFile;


public FileSaveSession(Charset encoding, boolean backup) throws SaveException {
this(encoding, backup, createTemporaryFile());
}
Expand Down Expand Up @@ -86,8 +85,12 @@ public void commit(Path file) throws SaveException {
LOGGER.error("Error when creating lock file.", ex);
}

// Try to save file permissions to restore them later (by default: allow everything)
Set<PosixFilePermission> oldFilePermissions = EnumSet.allOf(PosixFilePermission.class);
// Try to save file permissions to restore them later (by default: 664)
Set<PosixFilePermission> oldFilePermissions = EnumSet.of(PosixFilePermission.OWNER_READ,
PosixFilePermission.OWNER_WRITE,
PosixFilePermission.GROUP_READ,
PosixFilePermission.GROUP_WRITE,
PosixFilePermission.OTHERS_READ);
if (FileUtil.isPosixCompilant && Files.exists(file)) {
try {
oldFilePermissions = Files.getPosixFilePermissions(file);
Expand Down

0 comments on commit 5725308

Please sign in to comment.