Ticket #4667: preferences_chmod_600.patch
File preferences_chmod_600.patch, 1.3 KB (added by , 11 years ago) |
---|
-
src/org/openstreetmap/josm/data/Preferences.java
393 393 File tmpFile = new File(prefFile + "_tmp"); 394 394 copyFile(tmpFile, prefFile); 395 395 tmpFile.delete(); 396 397 setCorrectPermissions(); 396 398 } 397 399 400 public void setCorrectPermissions() throws IOException { 401 // Make it owner-only-readable. 402 // FIXME: newest versions will use JDK 1.6, it has set*() functions. 403 Runtime.getRuntime().exec("/bin/chmod 600 " + getPreferenceFile().getAbsolutePath()); 404 } 405 398 406 /** 399 407 * Simple file copy function that will overwrite the target file 400 408 * Taken from http://www.rgagnon.com/javadetails/java-0064.html (CC-NC-BY-SA) … … 509 517 System.err.println(tr("Warning: Failed to initialize preferences.Failed to reset preference file to default: {0}", getPreferenceFile())); 510 518 } 511 519 } 520 521 try { 522 setCorrectPermissions(); 523 } 524 catch (IOException e) { 525 e.printStackTrace(); 526 } 512 527 } 513 528 514 529 public final void resetToDefault(){