]> git.ipfire.org Git - thirdparty/libvirt.git/commit
virNetDevSaveNetConfig: Pass mode to virFileWriteStr()
authorMichal Privoznik <mprivozn@redhat.com>
Mon, 13 Jun 2022 12:20:06 +0000 (14:20 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Mon, 13 Jun 2022 14:06:44 +0000 (16:06 +0200)
commit74ba5b5401a7fe768fbfb71423ca78fb68ba2157
tree4b7cee5f98a638851c3e4cb1dec622983d4c47f8
parentd823f275978ebd0183dc24b9c812e639a5f3c29c
virNetDevSaveNetConfig: Pass mode to virFileWriteStr()

For some types of SRIOV interfaces we create a temporary file
where the state of the interface is saved before we start
modifying it. The file is used then to restore the original
configuration when the interface is no longer associated with any
guest. For writing the file virFileWriteStr() is used. However,
it's given wrong argument: the last argument is supposed to be
mode to create the file with but virNetDevSaveNetConfig() passes
open(2) flags (O_CREAT|O_TRUNC|O_WRONLY). We need the file to be
writable and readable by root only (0600). Therefore, pass that
mode instead of gibberish.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
src/util/virnetdev.c