|Summary:||ASTERISK-15334: [patch] ast_filecopy: keep modes for the created file|
|Reporter:||Romain Bignon (romain_proformatique)||Labels:|
|Date Opened:||2010-02-03 10:09:52.000-0600||Date Closed:||2010-03-10 01:05:04.000-0600|
|Environment:||Attachments:||( 0) asterisk_copy_file_keeps_modes.patch|
|Description:||In src/main/file.c, the static function “copy” creates a new file with the hardcoded 0600 mode.|
I've attached a patch to create the new file with the copied file's modes.
|Comments:||By: Tilghman Lesher (tilghman) 2010-03-10 00:43:08.000-0600|
This is actually incorrect. As stated in the open(2) documentation, the mode passed to the open(2) call is modified with the user umask, so opening with the mode from the previous file is not guaranteed to produce the same results. The better way to do this is to call fchmod(2) on the destination file descriptor.
By: Tilghman Lesher (tilghman) 2010-03-10 01:05:04.000-0600
Additionally, what we've decided to do going forward is to rely entirely on the umask to set the correct file modes. So the passed mode for files is 0666, and the umask will modify those permissions as the administrator intends. This is the way that it is in 1.6. We will not change 1.4 because of legacy concerns.