mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 16:53:55 -06:00
io: Fix QIOChannelFile when creating and opening read-write
The code wrongly passes the mode to open() only if O_WRONLY is set. Instead, the mode should be passed when O_CREAT is set (or O_TMPFILE on Linux). Fix this by always passing the mode since open() will correctly ignore the mode if it is not needed. Add a testcase which exercises this bug and also change the existing testcase to check that the mode of the created file is correct. Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com> Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
parent
a46ded1de5
commit
902f6e14fc
3 changed files with 27 additions and 10 deletions
|
@ -73,7 +73,7 @@ qio_channel_file_new_fd(int fd);
|
|||
* qio_channel_file_new_path:
|
||||
* @path: the file path
|
||||
* @flags: the open flags (O_RDONLY|O_WRONLY|O_RDWR, etc)
|
||||
* @mode: the file creation mode if O_WRONLY is set in @flags
|
||||
* @mode: the file creation mode if O_CREAT is set in @flags
|
||||
* @errp: pointer to initialized error object
|
||||
*
|
||||
* Create a new IO channel object for a file represented
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue