diff options
author | Ross Lagerwall | 2017-11-01 15:25:24 +0100 |
---|---|---|
committer | Daniel P. Berrangé | 2018-02-15 17:54:57 +0100 |
commit | 902f6e14fc68743ce24efb7d87dc3f8464a78bf3 (patch) | |
tree | 7ad393040358740e78d39eeafa4b31996d7d2095 /include/io | |
parent | io/channel-websock: handle continuous reads without any data (diff) | |
download | qemu-902f6e14fc68743ce24efb7d87dc3f8464a78bf3.tar.gz qemu-902f6e14fc68743ce24efb7d87dc3f8464a78bf3.tar.xz qemu-902f6e14fc68743ce24efb7d87dc3f8464a78bf3.zip |
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>
Diffstat (limited to 'include/io')
-rw-r--r-- | include/io/channel-file.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/io/channel-file.h b/include/io/channel-file.h index 79245f1183..ebfe54ec70 100644 --- a/include/io/channel-file.h +++ b/include/io/channel-file.h @@ -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 |