[PATCH 1/2] virNetDevSaveNetConfig: Pass mode to virFileWriteStr()

Peter Krempa pkrempa at redhat.com
Mon Jun 13 14:01:35 UTC 2022


On Mon, Jun 13, 2022 at 15:18:13 +0200, Michal Privoznik wrote:
> 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 at redhat.com>
> ---
>  src/util/virnetdev.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Peter Krempa <pkrempa at redhat.com>


More information about the libvir-list mailing list